0% found this document useful (0 votes)
3 views1 page

Set Assignment-Hints

The document outlines a classroom assignment focused on demonstrating the Set Interface in Java by writing a program to print unique characters from a given string. The assignment involves using the string 'google' as input and requires students to utilize a Set to store and filter unique characters. Upon completion, students should understand the concepts and methods related to the Set Interface in Java and how to extract unique elements from data.

Uploaded by

vm992612
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Set Assignment-Hints

The document outlines a classroom assignment focused on demonstrating the Set Interface in Java by writing a program to print unique characters from a given string. The assignment involves using the string 'google' as input and requires students to utilize a Set to store and filter unique characters. Upon completion, students should understand the concepts and methods related to the Set Interface in Java and how to extract unique elements from data.

Uploaded by

vm992612
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Classroom Assignment <2>: Demonstrating Set Interface in Java

Learning Objective:

To gain a clear understanding of Set Interface and its implementation classes in Java and identifying and printing only
unique characters in a given string.

Best Case: 15 minutes


Average Case: 20 minutes

Assignment Details:

- Writing a Java program that takes a string as input and prints only the unique characters from that String using
the Set interface and its implementation class.
- Given the String companyName = "google"`, the program should print: "gole"

Assignment Requirements:

- You are provided with a string variable: companyName = "google"


- Create a Set to store unique characters.
- Iterate through each character in the companyName string.
- Add each character into the Set.
- Print the unique characters from the string.

Hints to Solve:

- Initialize a Set of type Character to store unique characters.


- Loop through each character in the input string.
- Use appropriate method to add characters to the Set.
- To get the required output use the correct implementation class.

Reference Links:

Set in Java - Oracle Docs

Expected Outcome:

Upon completion, you should be able to:


- Grasp the fundamental concepts and methods associated with the Set Interface in Java.
- Understand how to effectively filter and process data to extract unique elements using Java Sets.

You might also like