0% found this document useful (0 votes)
37 views

Java

Java is a platform independent language that allows code to be written once and run anywhere. An object's lock is a mechanism used by threads to synchronize access to an object. All objects and classes have locks. The Object class is extended by all other classes in Java.

Uploaded by

Abina Bharathy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Java

Java is a platform independent language that allows code to be written once and run anywhere. An object's lock is a mechanism used by threads to synchronize access to an object. All objects and classes have locks. The Object class is extended by all other classes in Java.

Uploaded by

Abina Bharathy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

1. What is the most important feature of Java? 64. What is an object's lock and which object's have locks?

Java is a platform independent language. 2. What do you mean by platform independence? An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.

Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the 65. What is the % operator? class in any other supported platform eg (Linux,Solaris,etc). It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second 3. What is a JVM? operand. JVM is Java Virtual Machine which is a run time environment for the compiled java class files. 4. Are JVM's platform independent? 66. When can an object reference be cast to an interface reference? An object reference be cast to an interface reference when the object implements the referenced interface.

JVM's are not platform independent. JVM's 67. Which class is extended by all other classes? are platform specific run time implementation provided by the vendor. The Object class is extended by all other classes. 5. What is the difference between a JDK and a JVM? JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM. 6. What is a pointer and does Java support pointers? Pointer is a reference handle to a memory location. Improper handling of pointers leads to memory leaks and reliability issues hence Java doesn't support the usage of pointers. 7. What is the base class of all classes? 71. What is the return type of a program's main() method? java.lang.Object void. 8. Does Java support multiple inheritance? Java doesn't support multiple inheritance. 9. Is Java a pure object oriented language? Java uses primitive data types and hence is not a pure object oriented language. 72. If a variable is declared as private, where may the variable be accessed? A private variable may only be accessed within the class in which it is declared. 68. Which non-Unicode letter characters may be used as the first character of an identifier? The non-Unicode letter characters $ and _ may appear as the first character of an identifier 69. What restrictions are placed on method overloading? Two methods may not have the same name and argument list but different return types. 70. What is casting? There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.

You might also like