Java and J2EE Tutorials, Jsp and Servlet Tutorials, Spring MVC, Solr, XML, JSON Examples, Hibernate & Struts 2 Hello World projects

Tuesday, 24 June 2014

100 Core Java Interview Questions and Answers - Part 10

Here are top selected core java interview questions asked in high level interviews, these questions may be helpful for both freshers or experienced professional going for interview.

91) What is synchronization in Java?

In java synchronization is the ability to control the access of multiple threads to shared resources. Synchronization ensures that only one thread can access a shared resource at a time.

92) What are wrapper classes in Java.

Java provides some equivalent classes to represent primitive types as object these classes are called wrapper classes. There are 8 wrapper classes in java ; Byte, Short, Integer, Long, Float, Double, Character and Boolean.

93) Can we have more than one class declaration in a single java file.

We can have only a single public class declaration per java file, whereas we can have multiple non-public classes in a single java file.

94) Can we declare main() method as private?

No, We cannot declare main() method as private. If we does so the program will compile fine but at runtime it will give “Main Method Not Public” message.

95) Explain System.out.println() briefly?

System is a predefined final class, out is a PrintStream object and println is a built-in overloaded method in the out object.

Thanks for reading !
Being Java Guys Team


Like Us on Facebook

Like Us On Google+


Skype: neel4soft