29) How to perform Serialization and Deserialization? Use ObjectOutputStream for serialization and ObjectInputStream for deserialization. 30) What happens if you don't use serialization? Objects cannot be stored
JSP is an integral part of Java EE. If you are giving an interview for a web developer, then having good knowledge of JSP is very important. This post contains a list of 35 JSP interview questions with answers. Please make sure to bookmark it because I will be kept on adding more to...
Java Interview Questions/Java面试题 . What is transient variable? Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead w...
But an ability to “skip” the next object in the iteration stream might be helpful. And because the Iterator’s implementation is easily defined in terms of the other three, we can provide it, as shown in Listing 19.Listing 19 Copy Copied to Clipboard Error: Could not Copy interface ...
public static boolean hasPalindromePermutation(String str) { return str.chars() .boxed() .collect(Collectors.groupingBy( Function.identity(), Collectors.counting())) .entrySet() .stream() .filter(e -> e.getValue() % 2 == 1) .count() <= 1; }...
We can convert a Java object to a Stream that is called Serialization. Once an object is converted to Stream, it can be saved to file or send over the network or used in socket connections. The object should implement a Serializable interface and we can use java.io.ObjectOutputStream to ...
publicclassTest{publicstaticvoidmain(String args[]){try{Stringname="test.properties";InputStreamin=newBufferedInputStream(newFileInputStream(name));Propertiesp=newProperties(); p.load(in); System.out.println("a的值=="+ p.getProperty("a")); ...
Stream API:新添加的Stream API(java.util.stream) 把真正的函数式编程风格引入到Java中。 Date Time API: 加强对日期与时间的处理。 面试题2: 什么是FunctionalInterface ? 答:FunctionalInterface也称为“函数式接口”, 是只有一个抽象方法的接口。这些接口的实现是使用 Lambda 表达式提供的,这意味着要使用 Lambda...
An object is deserialized by reading it from an ObjectInputStream.Back to Top13. When to use Runnable interface Vs Thread class in Java?If we need our class to extend some other classes other than the thread then we can go with the runnable interface because in java we can extend only ...
This core Java question is followup of previous question and expecting candidate to write Java singleton using double checked locking. Remember to use volatile variable to make Singleton thread-safe. check 10 Interview questions on Singleton Pattern in Java for more details and questions answers ...