JAVA - J2EE Training Guide

Are You Looking For JAVA/J2EE Online Training ?

Fill in your details in below form, we will get back to you

Powered by Blogger.

Thursday 13 November 2014

Easy Questions on Core Java
  • 1. What is the Important feature of Java ?
Java is a platform independent language.
  • 2. What is mean by platform independence ?
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).
  • 3. Define JVM ?
JVM is Java Virtual Machine which is a run time environment for the compiled java class files.
  • 4. IS JVM\'s platform independent ?
 JVM\'s are not platform independent. JVM\'s are platform specific run time implementation provided by the vendor.
  • 5. Explain the principle of Encapsulation ?
Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.
  • 6. Explain the principle Inheritance ?
Inheritance is the process by which one object acquires the properties of another object.
  • 7. Explain Polymorphism principle ?
The meaning of Polymorphism is something like one name many forms. Polymorphism enables one entity to be used as as general category for different types of actions. The specific action is determined by the exact nature of the situation. The concept of polymorphism can be explained as \'one interface, multiple methods\'.
From a practical programming viewpoint, polymorphism exists in three distinct forms in Java:
                    * Method overloading
                    * Method overriding through inheritance
                    * Method overriding through the Java interface
  • 8. Define an abstract method ?
An abstract method is a method that don\'t have a body. It is declared with modifier abstract.
  • 10. What are local variables ?
Local varaiables are those which are declared within a block of code like methods. Local variables should be initialised before accessing them.
  • 11. What is the use of packages in java ?
Packages are a way to organize files in java when a project consists of more than one module. It helps in resolving name conflicts when different modules have classes with the same names.
  • 12. What is serialization ?
Serialization is the process of saving the state of an object.
  • 13. What is de-serialization ?
De-serialization is the process of restoring the state of an object.
  • 14. What is Externalizable ?
It is an interface that extends Serializable. It is having two different methods writeExternal() and readExternal. This interface allows us to customize the output.
  • 15. Define an Abstract class ?
An abstract class is an incomplete class. It is declared with the modifier abstract. We cannot create objects of the abstract class. It is used to specify a common behavioral protocol for all its child classes.
  • 16. What are instance variables ?
Instance variables are those which are defined at the class level. Instance variables need not be initialized before using them as they are automatically initialized to their default values.
  • 17. Define a package ?
Package is a collection of related classes and interfaces. package declaration should be first statement in a java class.
  • 18. What are the access modifiers available in Java ?
Access modifier specify where a method or attribute can be used. Public is accessible from anywhere. Protected is accessible from the same class and its sub classes. Package/Default are accessible from the same package. Private is only accessible from within the class.
  • 19. What is the difference between thread and process ?
A process runs in its own address space. No two processes share their address space. Threads will run in the same address space of the process that owns them.
  • 20. What is a garbage collection ?
Garbage collection is the process of releasing memory used by unreferenced objects. It relieves the programmer from the process of manually releasing the memory used by objects .
  • 21. What is the importance of a static variable ?
Static variables are class level variables where all objects of the class refer to the same variable. If one object changes the value then the change gets reflected in all the objects.
  • 22. What is Use of Abstract Class ?
 A Class which doesn't  provide complete implementation is defined as an abstract class. Abstract classes enforce abstraction.
  • 23. Can abstract class be declared as final ?
Not possible. An abstract class without being inherited is of no use and hence will result in compile time error.
  • 24. What is the use of a abstract variable ?
Variables can't be declared as abstract. only classes and methods can be declared as abstract.
  • 24. Define Multi-threading ?
Multi-threading is the scenario where more than one threads are running.
  • 25. Define deadlock ?
Deadlock is a situation when two threads are waiting on each other to release a resource. Each thread waiting for a resource which is held by the other waiting thread.
  • 26. Define the Local object ?
A Local object represents a specific geographical, political, or cultural region
  • 27. What is anonymous class ?
An anonymous class is a type of inner class that don’t have any name.
  • 28. What is class path ?
Class path is the path where Java looks for loading class at run time and compile time.
  • 29. What is path ?
It is an the location where the OS will look for finding out the executable files and commands.
  • 30. Why does Java not support operator overloading ?
Operator overloading makes the code very difficult to read and maintain. To maintain code simplicity, Java doesn't support operator overloading.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.