{"id":12924,"date":"2017-05-17T10:07:03","date_gmt":"2017-05-17T04:37:03","guid":{"rendered":"http:\/\/www.cmscomputer.in\/blog\/?p=12924"},"modified":"2024-03-05T16:34:01","modified_gmt":"2024-03-05T11:04:01","slug":"core-java-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/www.cmscomputer.in\/blog\/core-java-interview-questions-and-answers\/","title":{"rendered":"Core JAVA Interview Questions and Answers"},"content":{"rendered":"<p><strong>1. What is the most important feature of java?<\/strong><br \/>\nJava is platform independent language.<\/p>\n<p><strong>2. What do you mean by Platform Independence?<\/strong><br \/>\nPlatform Independence you can run and compile program in one platform and can execute in any other platform.<\/p>\n<p><strong>3. What is JVM (Java Virtual Machine)?<\/strong><br \/>\nJVM is Java Virtual Machine which is a run time Environment for the compiled java class.<\/p>\n<p><strong>4. What is JIT Compiler?<\/strong><br \/>\nJust-In-Time (JIT) compiler is used to improve the performance. JIT compiles parts of the byte code that have similar functionality at the same time.<\/p>\n<p><strong>5. Are JVM&#8217;s Platform Independent?<\/strong><br \/>\nJVM&#8217;S are not platform Independent. JVM&#8217;S are platform Specific.<\/p>\n<p><strong>6. What if main method declare as private?<\/strong><br \/>\nNo, It will compile fine but in run time it will error like main method should be in public. Cannot find main method.<\/p>\n<p><strong>7. What is platform?<\/strong><br \/>\nA platform is basically the hardware or software environment in which a program runs.<br \/>\nThere are two types of platforms software and hardware.<br \/>\nJava provides software-based platform.<\/p>\n<p><strong>8. What all memory areas are allocated by JVM?<\/strong><br \/>\nHeap, Stack, Program Counter Register and Native Method Stack.<\/p>\n<p><strong>9. What is the base class of all classes?<\/strong><br \/>\nlang.Object<\/p>\n<p><strong>10. What is javac?<\/strong><br \/>\nIt produces the java byte code from *.java file.<br \/>\nIt is the intermediate representation of your source code that contains instructions.<\/p>\n<p><strong>11. Can we mark constructors final?<\/strong><br \/>\nNo, Constructor cannot be declared final.<\/p>\n<p><strong>12. What are two different ways to call garbage collector?<\/strong><br \/>\ngc () OR Runtime. getRuntime ().gc ().<\/p>\n<p><strong>13. Can we override a static method?<\/strong><br \/>\nNo, we cannot override a static method. Static means class level.<\/p>\n<p><strong>14. Use of finalize () method in java?<\/strong><br \/>\nfinalize () method is used to free the allocated resource.<\/p>\n<p><strong>15. Is it possible to overload main() method of a class?<\/strong><br \/>\nYes, we can overload main () method as well.<br \/>\nBut every time public static main (String [] args) will be called automatically by JVM.<br \/>\nOther methods need to call explicitly.<\/p>\n<p><strong>16. Does Java support operator overloading?<\/strong><br \/>\nOperator overloading is not supported in Java.<\/p>\n<p><strong>17. Can I declare a data type inside loop in java?<\/strong><br \/>\nAny Data type declaration should not be inside the loop. It\u2019s possible but not recommended.<\/p>\n<p><strong>18. List two java IDEs?<\/strong><br \/>\nEclipse, Net beans and IntelliJ<\/p>\n<p><strong>19. Can we inherit the constructors?<\/strong><br \/>\nNo, we cannot inherit constructors.<br \/>\nWe can call super class constructors from subclass constructor by using super() call.<\/p>\n<p><strong>20. Can this keyword be assigned null value?<\/strong><br \/>\nNo, this keyword cannot have null values assigned to it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. What is the most important feature of java? Java is platform independent language. 2. What do you mean by Platform Independence? Platform Independence you can run and compile program in one platform and can execute in any other platform. 3. What is JVM (Java Virtual Machine)? JVM is Java<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_joinchat":[],"footnotes":""},"categories":[115,116,1],"tags":[74,76,75,73],"class_list":["post-12924","post","type-post","status-publish","format-standard","hentry","category-it-training","category-java-j2ee-net","category-uncategorized","tag-j2ee-training-in-bengaluru","tag-java-j2ee-training-institute-in-bengaluru","tag-java-training-center-in-bengaluru","tag-software-training-in-bengaluru"],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/posts\/12924"}],"collection":[{"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/comments?post=12924"}],"version-history":[{"count":7,"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/posts\/12924\/revisions"}],"predecessor-version":[{"id":13000,"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/posts\/12924\/revisions\/13000"}],"wp:attachment":[{"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/media?parent=12924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/categories?post=12924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cmscomputer.in\/blog\/wp-json\/wp\/v2\/tags?post=12924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}