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

Java Identifiers and Common Questions

The document outlines rules for Java identifiers, emphasizing that they must start with a letter, underscore, or dollar sign, and are case-sensitive with no special characters allowed. It includes answers to questions about creating a Map of names and vowel counts, explaining wrapper classes and their properties, using streams to filter employees by salary, and finding the second largest number in a list of integers. Additionally, it demonstrates the use of collectors in Java streams for grouping and counting elements.

Uploaded by

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

Java Identifiers and Common Questions

The document outlines rules for Java identifiers, emphasizing that they must start with a letter, underscore, or dollar sign, and are case-sensitive with no special characters allowed. It includes answers to questions about creating a Map of names and vowel counts, explaining wrapper classes and their properties, using streams to filter employees by salary, and finding the second largest number in a list of integers. Additionally, it demonstrates the use of collectors in Java streams for grouping and counting elements.

Uploaded by

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

Notes:

Java Identifiers:
1. they must start with a letter, an underscore or a dollar sign
2. case-sensitive
3. underscore and dollar sign, no other special characters or spaces are allowed in
identifiers.

asked questions:
1. I have a
List<String> names = [Link]("agduiadsa","sjsadas","asdgsa")

return a Map<String,Integer> containing number the name and number of vowels

2. A wrapper class wraps (encloses) around a data type and gives it an object
appearance.
Wrapper classes are final and immutable. Two concepts are there in the wrapper
classes namely autoboxing and unboxing

3. streams with filter


[Link](new Employee("John", "1", "Engineer"));
[Link](new Employee("Vamshi", "2", "Engineer"));

[Link](new Employee("John", "1", "Engineer"));


[Link](new Employee("Vamshi", "2", "Engineer"));

List<Employee> salaryAbove = [Link]().filter( item ->


([Link] > 500)).ToList()

4. second largest.
List<Integer> listofIntergers = new ArrayList();

[Link](1);
[Link](2);
[Link](3);

List<Integer> output = [Link]().Collectors([Link]())

var secondlargest = listofIntergers.


var foo = [Link]( i -> i=
sendondlargerst).[Link]();

Map<Integer,Integer> bar = [Link]().groupby(


(k,v) -> count(v)
). tolist(). get(2)

You might also like