Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers for 'Raytheon' - 2 question(s) found - Order By Rating | ||||
| ||||
Ans. public class Class{ public static void main(String[] args){ List<Integer> collector = new ArrayList(); Scanner scanner = new Scanner(System.in); int x = scanner.nextInt(); while(x != 0){ collector.add(x); x = scanner.nextInt(); } System.out.println(collector.stream().collect(Collectors.averagingInt(p->((Integer)p)))); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  coding  code  collector  streams  Collectors.average Asked in 1 Companies | ||||
Related Questions | ||||
What is a stream and what are the types of Streams and classes of the Streams? | ||||
Explain System.out.println ? | ||||
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy? | ||||
Which class is used to read streams of characters from a file? | ||||
Which class is used to read streams of raw bytes from a file? | ||||
How Spliterator in Java 8 different than iterator ? | ||||
Which is better in terms of performance - Iterator or Spliterator ? | ||||
Difference between System.out.printf and System.out.println ? | ||||
What is the difference between the Reader/Writer java.io hierarchy and the Stream class hierarchy? | ||||
Why is it important to close files and streams ? | ||||
Frequently asked in Cognizant (CTS) | ||||
| ||||
Ans. Storing the state of an object in a file or other medium is called serialization. Classes can communicate only if they are built together ( as they need Byte code for communication ). What if we need to enable communication between different applications ( i.e they have been built independently or even they reside at different locations ), We need a mechanism that will transfer the Bean state to a Medium than can be transferred to the receiving application. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   serialization Asked in 18 Companies basic   frequent | ||||
Try 1 Question(s) Test | ||||
Related Questions | ||||
Can we declare static variables as transient ? | ||||
Which elements of a class are ignored during serialization ? | ||||
Can we serialize static variables ? | ||||
What one should take care of, while serializing the object? | ||||
What is the use of Transient Keyword ? | ||||
serialization and deserialization of singleton class | ||||
Difference between Serialization and Deserialization ? | ||||
What is an Externalizable interface ? | ||||
Difference between serializable and externalizable interface ? | ||||