Java Interview Questions for Beginners — 5

Common Interview Questions

public boolean equals(Object obj)
public int hashCode()
int a = 10;Integer a2 = new Integer(a); // Without AutoboxingInteger a3=a; //With Autoboxing
​Integer a = new Integer(10);int a2 = a; // Integer will be converted to int automatically
static {// code goes here}
String ​state = “​Tamilnadu”;
class Student{}class Hostel_Student extends Student{}class Library_Member extends Student{}Student s1 = new Student();Student s2 = new Hostel_Student();Student s3 = new Library_Member();if(s1 instanceof Student) // Result is trueif(s2 instance of Hostel_Student) //Result is true

Other Stories



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store