Class, Variable, Constructor, Object, Method Questions http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions https://www.careerride.com/java-objects-classes-methods.aspx https://javaconceptoftheday.com/java-practice-questions-on-classes-andobjects/ https://www.geeksforgeeks.org/java-interview-questions-constructors/ https://www.javabykiran.com/interview/corejava/constructor-interviewquestions.php https://javaconceptoftheday.com/java-interview-questions-onconstructors/ https://www.javapedia.net/methods https://javaconceptoftheday.com/important-java-interview-questions-onmethod-overloading/ http://www.wideskills.com/java-interview-questions/java-classes-andobjects-interview-questions What restrictions are placed on method overloading? What is the difference between String and StringBuffer? Can a private method of a superclass be declared within a subclass? What is the default value of an object reference declared as an instance variable? What is the difference between a constructor and a method? Or How can a subclass call a method or a constructor defined in a superclass? Can a top-level class be private or protected? Why Java does not support multiple inheritance? How are this() and super() used with constructors? What is Method Overriding? What restrictions are placed on method overriding? What is a singleton class? Or What is singleton pattern? What are the Object and Class classes used for? Which class should you use to obtain design information about an object? Differentiate between a Class and an Object?
What is a singleton class? Or What is singleton pattern? What is method overloading and method overriding? Or What is difference between overloading and overriding? If a class is declared without any access modifiers, where may the class be accessed? Does a class inherit the constructors of its superclass? Which java.util classes and interfaces support event handling? Can an object s finalize() method be invoked while it is reachable? What is the purpose of the Runtime class? What is the purpose of the System class? Can an unreachable object become reachable again? What is a bean? Where can it be used? What is the functionality of instanceof()?
What would happen if you say this = null? I want to create two instances of a class,but when trying for creating third instance it should not allow me to create. What i have to do for making this? What is the difference between an object and an instance? What is heap in Java? Why default constructor of base class will be called first in java? What are the other ways to create an object other than creating as new object?
What is the difference between instance, object, reference and a class? https://www.careerride.com/java-objects-classes-methods.aspx Define class and object. Explain them with an example using java What is a method? Provide several signatures of the methods Difference between instance variable and a class variable Explain how to create instance of a class by giving an example Define an abstract class. Explain its purpose What is the difference between an Abstract class and Interface? What is singleton class? Where is it used? What is a native method? Difference between a public and a non-public class What is the purpose of the Runtime class? What is the difference between a and a non- inner class? Difference between the String and StringBuffer classes What is the Dictionary class? What is the ResourceBundle class? What is the Vector class? What is the SimpleTimeZone class? What is the purpose of the System class? How are this() and super() used with constructors? https://javaconceptoftheday.com/java-practice-questions-on-classes-andobjects/ Which of the following is true about Static Initialization Block? A. We can use only members of a class inside the Static Initialization Block. B. Static Initialization Blocks are mainly used to initialize fields of a class. C. Static Initialization Block is the first block to be executed after class is loaded in the memory. D. All of the above. Where the initialization blocks are stored in the memory? What will be the output of this program? int i; System.out.println(1); i = 100; public class StaticInitializationBlock
System.out.println(2); public void main(string[] args) System.out.println(3); System.out.println(A.i); What happens when you compile the below class? int i; System.out.println(i); Is the below code written correctly? System.out.println(1); How many initialization blocks are there in the below Class A? int a = 50; a = 50; a = 50; What will be the outcome of the following program? public System.out.println(1);
System.out.println(2); System.out.println(3); public void main(string[] args) A a; What will be the output of this program? int first; String second; System.out.println(1); first = 100; System.out.println(2); second = "SECOND"; public class StaticInitializationBlock System.out.println(3); public void main(string[] args) System.out.println(4); System.out.println(A.first); System.out.println(A.second); What will be the output of the below program?
int i; i = 100; System.out.println(1); void Method() System.out.println(i); System.out.println(2); public class B System.out.println(3); public void main(string[] args) System.out.println(4); System.out.println(A.i); A.Method(); What is the difference between SIB and IIB? SIB - Static Initialization Block IIB Instance Initialization Block https://www.geeksforgeeks.org/java-interview-questions-constructors/ What is a Constructor? Do we have Copy Constructor in Java? What is Constructor Chaining? Can we call sub class constructor from super class constructor? What happens if you keep a return type for a constructor? What is No-arg constructor? How a no argument constructor is different from default Constructor? What are private constructors and where are they used? When do we need Constructor Overloading? Do we have destructors in Java?
https://www.javabykiran.com/interview/corejava/constructor-interviewquestions.php Is it mandatory to define a constructor in a class? Define a constructor Can we define a method with the same name as that of a class? How can a compiler and a JVM differentiate between constructor and method definitions if both have same name as the class has? What are the rules for defining a constructor? If we place a return type in a constructor prototype will it throw error? Why a return type is not allowed for Constructor? How does a compiler and JVM differentiate constructor and method invocations if both have same name as class name? Can we declare constructor as private? Why a compiler given constructor is called as default constructor? Why a constructor name is same as class name? What is default accessibility modifier of a default constructor? In which situation it is mandatory for the developer to provide constructor explicitly? When does a compiler provide default constructor? If class has explicit constructor then will it have a default constructor? What is Constructor Chaining? What will happen if one keeps a return type for a constructor? Can we call sub class constructor from super class constructor? What is no-arg constructor? What is the use of private constructor? What is constructor chaining and how can it be achieved in Java? Can we use this() and super() in a method? What is default constructor? Can we overload constructors? Does a constructor create the object? What are the common uses of this keyword in java? https://javaconceptoftheday.com/java-interview-questions-onconstructors/ Can you create an object without using new operator in Java? Using newinstance() method Using clone() method Using object deserialization What is constructor chaining? Can we call sub class constructor from super class constructor?
What happens if you keep return type for a constructor? What is No-arg constructor? What is the use of private constructor? Can we use this() and super() in a method? https://www.javapedia.net/methods Can a main method be declared final? Is the main() method required for all java classes? Difference between arguments and parameters in Java. What is the return type of main() method?
Why does the main() method declared? What is the the argument for main() method? Can a main() method be overloaded? When no command line arguments are passed, does the String array parameter of main() method be null? Can we invoke a method on a null object reference in Java? Explain the Default method for interfaces in Java 8. Advantages of default method in Interface feature in Java 8. Explain the interface methods feature in Java 8. Advantages of using interface method in Java 8. Difference between default and methods in Java interface. Explain pass by reference and pass by value in Java? Difference between System.exit(0), exit (1) and exit(-1) in Java. What is virtual function/method in Java? Can we define a method in a Java interface? What is fluent interface in Java? Explain method chaining in Java. What is synthetic method in Java? What is bridge method in Java? What is a method reference in Java 8? Types of method references in Java 8. Are Java calls less expensive than non- calls? What is lambda expression in Java 8? What is the target type of lambda expression? Can you Serialize lamda expression in Java8? What is System.out.println expression? Other names for default methods in Java 8. Is abstract modifier allowed in default method? What is the scope of default methods in Java8? How do I extend Interfaces that contain Default Methods? Explain the scenario how Default Method can cause Multiple Inheritance Ambiguity Problem. Why Java doesn't allow overriding of methods? https://javaconceptoftheday.com/important-java-interview-questions-onmethod-overloading/ What is method overloading? What is method signature? What are the things it consist of?
Can we declare one overloaded method as and another one as non-? How do compiler differentiate overloaded methods from duplicate methods? Is it possible to have two methods in a class with same method signature but different return types? In MyClass, there is a method called mymethod with four different overloaded forms. All four different forms have different visibility ( private, protected, public and default). Is mymethod properly overloaded? Can overloaded methods be synchronized? Can we overload main() method? Can we declare overloaded methods as final? In the below class, is constructor overloaded or is method overloaded? public public A() //-----> (1) void A() //-----> (2) Overloading is the best example of dynamic binding. True or false? Can overloaded method be overrided?