DnD Infosoft Pvt. Ltd.
 
Our news
15th October 2015
Discount on Training Program

Discount on Training Program s only for those students who has completed Graduation degree before 2015, Registration Last date 15 November, Discount 30 % or above on Every Programs Read more

15th November 2015
Freshers to IT Experts Programs

Only For Freshers Who completed Graduation in 2015, Reg. Last date 20 December on Every Programs Read more

Newsletter

Please enter your email address to subscribe our newsletter

Submit Query

Name:
Email Id:
Mobile No:
Education:
Timing:
Query:
  
 
Java Important Questions
image

Q1. What is the difference between an Inner Class and a Sub-Class?
Q2. What are three access specifiers for Java classes?
Q3. What’s the purpose of Static methods and static variables?
Q4. What is data encapsulation and what’s its significance?
Q5. What is a singleton class? Give a practical example of its usage.
Q6. What are Loops in Java? What are three types of loops?
Q7: What is an infinite Loop? How infinite loop is declared?
Q8. What is the difference between continue and break statement?
Q9. What is the difference between double and float variables in Java?
Q10. What is Final Keyword in Java? Give an example.
Q11. What is ternary operator? Give an example.
Q12: What are 6 different types of operators in Java?
Q13. What is default switch case? Give example.
Q14. What’s the base class in Java from which all classes are derived?
Q15. Can main() method in Java can return any data?
Q16. What are Java Packages? What’s the significance of packages?
Q17. Can we declare a class as Abstract without having any abstract method?
Q18. What’s the difference between an Abstract Class and Interface in Java?
Q19. What are the performance implications of Interfaces over abstract classes?
Q20. Does Importing a package imports its sub-packages as well in Java?
Q21. Can we declare the main method of our class as private?
Q22. How can we pass argument to a function by reference instead of pass by value?
Q23. How an object is serialized in java?
Q24. When we should use serialization?
Q25. Is it compulsory for a Try Block to be followed by a Catch Block in Java for Exception handling?
Q26. Is there any way to skip Finally block of exception even if some exception occurs in the exception block?
Q27. When the constructor of a class is invoked?
Q28. Can a class have multiple constructors?
Q29. Can we override static methods of a class?
Q30. In the below example, what will be the output?
Q31. Is String a data type in java?
Q32. In the below example, how many String Objects are created?
Q33. Why Strings in Java are called as Immutable?
Q34. What’s the difference between an array and Vector?
Q35. What is multi-threading?
Q36. Why Runnable Interface is used in Java?
Q37. What are the two ways of implementing multi-threading in Java?
Q38. When a lot of changes are required in data, which one should be a preference to be used? String or StringBuffer?
Q39. What’s the purpose of using Break in each case of Switch Statement?
Q40. How garbage collection is done in Java?
Q41. How we can execute any code even before main method?
Q42. Can a class be a super class and a sub-class at the same time? Give example.
Q43. How objects of a class are created if no constructor is defined in the class?
Q44. In multi-threading how can we ensure that a resource isn’t used by multiple threads simultaneously?
Q45. Can we call the constructor of a class more than once for an object?
Q46. There are two classes named classA and classB. Both classes are in the same package. Can a private member of classA can be accessed by an object of classB?
Q47. Can we have two methods in a class with the same name?
Q48. How can we make copy of a java object?
Q49. What’s the benefit of using inheritance?
Q50. What’s the default access specifier for variables and methods of a class?
Q51. Give an example of use of Pointers in Java class.
Q52. How can we restrict inheritance for a class so that no class can be inherited from it?
Q53. What’s the access scope of Protected Access specifier?
Q54. What’s difference between Stack and Queue?
Q55. In java, how we can disallow serialization of variables?
Q56. How can we use primitive data types as objects?
Q57. Which types of exceptions are caught at compile time?
Q58. Describe different states of a thread.
Q59. Can we use a default constructor of a class even if an explicit constructor is defined?
Q60. Can we override a method by using same method name and arguments but different return types?
Q61.What will be the output of following piece of code?
Q61. A person says that he compiled a java class successfully without even having a main method in it? Is it possible?
Q62. Can we call a non-static method from inside a static method?
Q63. What are the two environment variables that must be set in order to run any Java programs?
Q64. Can variables be used in Java without initialization?
Q65. Can a class in Java be inherited from more than one class?
Q66. Can a constructor have different name than a Class name in Java?
Q67. What will be the output of Round(3.7) and Ceil(3.7)?
Q68: Can we use goto in Java to go to a particular line?
Q69. Can a dead thread be started again?
Q70. Is the following class declaration correct?
Q71. Is JDK required on each machine to run a Java program?
Q72. What’s the difference between comparison done by equals method and == operator?
Q73. Is it possible to define a method in Java class but provide it’s implementation in the code of another language like C?
Q74. How destructors are defined in Java?
Q75. Can a variable be local and static at the same time?
Q76. Can we have static methods in an Interface?
Q77. In a class implementing an interface, can we change the value of any variable defined in the interface?
Q78. Is it correct to say that due to garbage collection feature in Java, a java program never goes out of memory?
Q79. Can we have any other return type than void for main method?
Q80. I want to re-reach and use an object once it has been garbage collected. How it’s possible?
Q81. In Java thread programming, which method is a must implementation for all threads?
Q82. I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
Q83. How can an exception be thrown manually by a programmer?
Q84. I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?
Q85. How objects are stored in Java?
Q86. How can we find the actual size of an object on the heap?
Q87. Which of the following classes will have more memory allocated?
Q88. What happens if an exception is not handled in a program?
Q89. I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?
Q90. What’s meant by anonymous class?
Q91. Is there a way to increase the size of an array after its declaration?
Q92. If an application has multiple classes in it, is it okay to have a main method in more than one class?
Q93. I want to persist data of objects for later use. What’s the best approach to do so?
Q94. What is a Local class in Java?
Q95. String and StringBuffer both represent String objects. Can we compare String and StringBuffer in Java?
Q96. Which API is provided by Java for operations on set of objects?
Q97. Can we cast any other type to Boolean Type with type casting?
Q98. Can we use different return types for methods when overridden?
Q99. What’s the base class of all exception classes?
Q100. What’s the order of call of constructors in inheritiance?

Featured Projects
image 2 image 3 image 4 image 4
 
 
Frequently Ask Questions
  • What is Asp.Net and what it does?
  • What is an application server?
  • What is a base class and derived class?
  • What are the differences between a control and a component?
  • What are functional and non-functional requirements?