Whats the purpose of Static methods and static variables? Ans: When there is a requirement to share a method or a variable between multiple objects of a class instead of creating separate copies for each object, we use static keyword to make a method or variable shared for all objects. It can be declared only once all other switch cases have been coded. Below files can be used by both freshers and experienced. Can a class in Java be inherited from more than one class? Ans: In Java, a class can be derived from only one class and not from multiple classes. Q63. How its possible? Ans: Once an object has been destroyed by garbage collector, it no longer exists on the heap and it cant be accessed again. For example, if a developer imports a package university.*, all classes in the package named university are loaded but no classes from the sub-package are loaded. For example, in below code we have defined an anonymous class in one line ofcode: Java public java.util.Enumeration testMethod() { return new java.util.Enumeration() { Override public boolean hasMoreElements() { // TODO Auto-generated method stub return false; } Override public Object nextElement() { // TODO Auto-generated method stub return null; } } 123456789101112131415161718192021222324252627282930313233 public java.util.Enumeration testMethod(){return new java.util.Enumeration(){Overridepublic boolean hasMoreElements(){// TODO Auto-generated method stubreturn false;}Overridepublic Object nextElement(){// TODO Auto-generated method stubreturn null;}} Q91. It will be.March 18, 2015 - 4:40 am by seosanjayupadhyayreally great information.am prepared interview purp.March 18, 2015 - 3:43 am by ramesh562Tags.net android asp.net binary tree business analysis business analyst C CCNA common core java database data structure datawarehouse hibernate how to write recommendation letter HTML informatica Internet Interview J2EE java job search linked list Linux management Microsoft networking o.s. Q71.

When an object is destroyed by a garbage collector, the space allocated to it from the heap is re-allocated to the heap and becomes available for any new objects. Q5. } public class country extends continent { . Whats the default access specifier for variables and methods of a class? Ans: Default access specifier for variables and method is package protected i.e variables and class is available to any other class but in the same package,not outside the package. 2009 - 2016 by IndiaBIXï¿½ Technologies. Java public class constexample { constexample() { System.out.println("Inside constructor"); } public static void main(String args[]) { constexample c1=new constexample(); constexample c2=new constexample(); } } 1234567891011121314151617 public class constexample {constexample() {System.out.println("Inside constructor");}public static void main(String args[]) {constexample c1=new constexample();constexample c2=new constexample();}} Q28. So, garbage collection helps in reducing the chances of a program going out of memory but it doesnt ensure that. Finally block is always executed when an exception occurs and the only way to avoid execution of any statements in Finally block is by aborting the code forcibly by writing following line of code at the end of try block: Java System.exit(0); 1 System.exit(0); Q27. Q57. For automatic garbage collection java calls either System.gc() method or Runtime.gc() method.

Can we have static methods in an Interface? Ans: Static methods cant be overridden in any class while any methods in an interface are by default abstract and are supposed to be implemented in the classes being implementing the interface. Check your spam folders, it might have landed there.Reply Jansi saysApril 24, 2016 at 6:40 pm please send the java interview questions pdf.its urgent for meReply M. You must always prepare hard before going to an interview and read all types of questions and answers related to java. So we cant use concept of pointers in Java. Whats the order of call of constructors in inheritiance? Ans: In case of inheritance, when a new object of a derived class is created, first the constructor of the super class is invoked and then the constructor of the derived class is invoked. Can we compare String and StringBuffer in Java? Ans: Although String and StringBuffer both represent String objects, we cant compare them with each other and if we try to compare them, we get an error. Whats difference between Stack and Queue? Ans: Stack and Queue both are used as placeholder for a collection of data. JournalDevJava, Java EE, Android, Web Development TutorialsJava Tutorial#Index PostsCore Java TutorialJava Design PatternsServlet JSP TutorialStruts 2 TutorialSpring TutorialJSF TutorialPrimefaces TutorialJDBC TutorialHibernate TutorialMongoDB Tutorial#Interview QuestionsJava Interview QuestionsJDBC Interview QuestionsServlet Interview QuestionsJSP Interview QuestionsStruts2 Interview QuestionsSpring Interview QuestionsHibernate Interview QuestionsJSF Interview QuestionsResourcesStoreHome Books Java Interview Questions and Answers PDF eBook Free Download (250 Questions, 60 Pages)Java Interview Questions and Answers PDF eBook Free Download (250 Questions, 60 Pages)July 13, 2016 by Pankaj 63 CommentsI was getting a lot of emails and comments to create java interview questions and answers PDF eBook. e52a6f0149