![]() ![]() final variables should be initialized before using them. What is the purpose of declaring a variable as final?Ī final variable’s value can’t be changed. Main() method is called by the JVM even before the instantiation of the class hence it is declared as static. Why is the main() method declared static? Can a class declared as private be accessed outside it’s package? What is the access scope of a protected method?Ī protected method can be accessed by the classes within the same package or by the sub classes of the class in any package. Yes a single source file can contain any number of Class declarations but only one of the class can be declared as public. Can a source file contain more than one class declaration? Main() method accepts an array of String object as argument. ![]() Java.lang package is imported by default even without a package declaration. Static final int PI = 2.14 is an example for constant. So only one copy of the variable exists for all instances of the class and the value can’t be changed also. The variable should be declared as static and final. How to define a constant variable in Java? only methods can be declared as protected. Can a class be declared as protected?Ī class can’t be declared as protected. A sub-class can’t have the same method signature with a different implementation. What is the impact of declaring a method as final?Ī method declared as final can’t be overridden. It doesn’t matter but void should always come before main().ġ7. Does the order of public and static declaration matter in main() method? But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM. JDK is Java Development Kit which is for development purpose and it includes execution environment also. What is the difference between a JDK and a JVM? Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the class in any other supported platform eg (Linux,Solaris,etc). What do you mean by platform independence? You can have any number of main() methods with different method signature and implementation in the class. JVM’s are platform specific run time implementation provided by the vendor. Java uses primitive data types and hence is not a pure object oriented language. Local variables should be initialized before accessing them. Local variables are those which are declared within a block of code like methods. Main() method doesn’t return anything hence declared void. What is the return type of the main() method? ![]() Improper handling of pointers leads to memory leaks and reliability issues hence Java doesn’t support the usage of pointers. Pointer is a reference handle to a memory location. ![]() What is a pointer and does Java support pointers? Instance variables need not be initialized before using them as they are automatically initialized to their default values. Instance variables are those which are defined at the class level. Path is used define where the system can find the executables(.exe) files and classpath is used to specify the location. Path and Classpath are operating system level environment variables. What is difference between Path and Classpath? What is the most important feature of Java? Java doesn’t support multiple inheritance. JVM is Java Virtual Machine which is a run time environment for the compiled java class files. Manual Testing Tutorial for Beginners Core Java Interview Questions and Answers 1. Python Programming Free Videos (Full Course) Selenium Online Training with Project (by G C Reddy) Core Java Interview Questions, Java Standard Edition, Java Programming Environment setup, programming Languages Fundamentals, and Object oriented programming concepts. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |