javapandit.net
  • Home
  • Quick Java
    • Exception Handling
    • Collections Framework
  • Java Best Practices
  • Web Services
    • Web Service Basics
    • Ten Basic webservice concepts
    • XML
    • Apache Axis
    • Restful Web Services
  • JMS Concepts
    • JMS- MySQL
  • Hadoop
    • NoSQL DATABASEs
    • Apache Sqoop
    • Hadoop Interview Questions
  • Java 5
  • Java 8
    • Java 8 : Lambda Expressions
  • JDBC
  • Java Architect
    • Enterprise application re-platforming strategies
    • Java Memory Management
  • Java Programs
  • Technical Tips
    • How to set JAVA_HOME environment variable
    • How to create an auto increment field in Oracle?
    • Linux Commands
  • Best Java Interview Questions
    • Java Interview Questions- YouTube
  • Interview Questions
    • Java Tech interview Questions
    • Core Java Interview Questions >
      • core tech questions1
      • Java Collection interview questions
      • Java Concurrency
    • Servlets Interview Questions
    • JSP Interview Questions
    • Java Web Services Interview Questions
    • EJB Interview Questions
    • XML Interview Questions
    • JMS Interview Questions
  • Struts Interview Questions
    • Struts 2 Interview Questions
  • Java EE Architects Interview Questions
    • Java Architect Interview Questions
    • Top 10 reasons for Java Enterprise Application Performance Problems
    • Web Application Scalability Questions for IT Architect
  • JavaPandit's Blog
  • Web Services Interview Questions
  • Servlets And JSP
  • Oracle SOA Interview Questions
    • Open ESB /JBI
    • BPEL Language
  • Log4J
  • Ant
  • Maven
  • JMeter
  • JUnit
  • Apache POI Framework
  • ORCALE SERVICE BUS (OSB) Interview Questions
  • J2EE Patterns
    • Model-View-Controller (MVC)
    • Front Controller
    • DAO
    • Business Delegate
    • Session Facade
    • Service Locator
    • Transfer Object
    • Design Patterns >
      • Creational Patterns >
        • Singleton
      • Behavioural Patterns
      • Structural Patterns
    • Intercepting Filter
  • SQL Interview Questions/Lab
  • Best Wall Papers
    • Devotional Songs
  • Java Community
  • HIBERNATE
  • ORACLE CC&B
    • Oracle CC&B Interview Questions
  • Docker
  • Little Princess
    • Sai Tanvi Naming Ceremony Celebrations
    • Rice Feeding Ceremony
    • Sai Tanvi Gallery
  • APPSC Career Guidance
    • AP History
    • Indian Polity
    • Indian Economy
    • Science & Technology
    • Mental Ability and Reasoning
    • Disaster Management
    • Current Affairs and Events
    • General Sciences >
      • Biology
      • Physics
      • Chemistry
    • Previous Question Papers
  • About Us
  • Contact US
Abstraction:  Showing the essential and hiding the non-Essential is known as Abstraction.

Encapsulation: The Wrapping up of data and functions into a single unit is known as Encapsulation. Encapsulation is the term given to the process of hiding the implementation details of the object. Once an object is encapsulated, its implementation details are not immediately accessible any more. Instead they are packaged and are only indirectly accessed via the interface of the object.

Inheritance: is the Process by which the Obj of one class acquires the properties of Obj’s another Class. A reference variable of a Super Class  can be assign to any Sub class derived from the Super class.

Inheritance is the method of creating the new class based on already existing class , the new class derived is called Sub class which has all the features of existing class and its own, i.e sub class.

Adv: Re-usability of code, accessibility of variables and methods of the Base class by the Derived class.
 
Polymorphism: The ability to take more that one form, it supports Method Overloading &  Method Overriding. 
  • Method overloading: When a method in a class having the same method name with different arguments (diff Parameters or Signatures) is said to be Method Overloading. This is Compile time Polymorphism.
    • Using one identifier to refer to multiple items in the same scope.
  • Method Overriding: When a method in a Class having same method name with same arguments is said to be Method overriding. This is Run time Polymorphism.
  • Providing a different implementation of a method in a subclass of the class that originally defined the method.

 1. In Over loading there is a relationship between the methods available in the same class ,where as in Over riding there is relationship between the Super class method and Sub class method.
 2. Overloading  does not block the Inheritance from the Super class , Where as in Overriding blocks Inheritance from the Super Class.
 3. In Overloading separate methods share the same name, where as in Overriding Sub class method replaces the Super Class.
4. Overloading  must have different method Signatures , Where as Overriding methods must have same Signatures. 

Dynamic Dispatch: is a mechanism by which a call to Overridden function is resolved at run-time rather than at Compile time , and this is how Java implements Run time Polymorphism.

  1. Dynamic Binding: Means the code associated with the given procedure call is not known until the time of call the call at run time. (it is associated with Inheritance & Polymorphism).
                         
                    @@@@@@@@@@@@@@@@@@@@@@@@@


Bite code: Is a optimized set of instructions designed to be executed by Java-run time system, which is called the Java Virtual machine (JVM), i.e. in its standard form, the JVM is an Interpreter for byte code.

JIT- is a compiler for Byte code, The JIT-Complier is part of the JVM, it complies byte code into executable code in real time, piece-by-piece on demand basis.
 
Final classes :   String, Integer , Color, Math
Abstract class :  Generic servlet, Number class
  • variable:An item of data named by an identifier.Each variable has a type,such as int or Object, and a scope.
  • class variable :A data item associated with a particular class as a whole--not with particular instances of the class. Class variables are defined in class definitions. Also called a static field. See also instance variable.
  • instance variable :Any item of data that is associated with a particular object. Each instance of a class has its own copy of the instance variables defined in the class. Also called a field. See also class variable.
  • local variable :A data item known within a block, but inaccessible to code outside the block. For example, any variable defined within a method is a local variable and can't be used outside the method.
  • class method :A method that is invoked without reference to a particular object. Class methods affect the class as a whole, not a particular instance of the class. Also called a static method. also instance method.
  • instance method :Any method that is invoked with respect to an instance of a class. Also called simply a method. See also class method.
 
  1. Interface: Interfaces can be used to implement the Inheritance relationship between the non-related classes that do not belongs to the same hierarchy, i.e. any Class and any where in hierarchy.   Using Interface, you can specify what a class must do but not how it does.
  • A class can implement more than one Interface.
  • An Interface can extend one or more interfaces, by using the keyword extends.
  • All the data members in the interface are public, static and Final by default.
  • An Interface method can have only Public, default and Abstract modifiers.
  • An Interface is loaded in memory only when it is needed for the first time.
  • A Class, which implements an Interface, needs to provide the implementation of all the methods in that Interface.
  • If the Implementation for all the methods declared in the Interface are not provided , the class itself has to declare abstract, other wise the Class will not compile.
  • If a class Implements two interface and both the Intfs have identical method declaration, it is totally valid. 
  • If a class implements tow interfaces both have identical method name and argument list, but different return types, the code will not compile.
  • An Interface can’t be instantiated. Intf Are designed to support dynamic method resolution at run time.
  • An interface can not be native, static, synchronize, final, protected or private.
  • The Interface fields can’t be Private or Protected.
  • A Transient variables and Volatile variables can not be members of  Interface.
  • The extends keyword should not used after the Implements keyword, the Extends must always come before the Implements keyword.
  • A top level Interface can not be declared as static or final.
  • If an Interface species an exception list for a method, then the  class implementing the interface need not declare the method with  the exception list.
  • If an Interface can’t specify an exception list for a method, the class can’t throw an exception.
  • If an Interface does not specify the exception list for a method, he class can not throw any exception list.
The general form of Interface is
Access interface name {
         return-type method-name1(parameter-list);
            type final-varname1=value;
          }
-----------------------
Marker Interfaces :  Serializable, Clonable, Remote, EventListener,
 
Java.lang is the Package of all classes and is automatically imported into all Java Program
Interfaces:  Clonable , Comparable, Runnable
  1. Abstract Class:   Abstract classes can be used  to implement the inheritance relationship between the classes that belongs same hierarchy.
  • Classes and methods can be declared as abstract.
  • Abstract class can extend only one Class.
  • If a Class is declared as abstract , no instance of that class can be created.
  • If a method is declared as abstract, the sub class gives the implementation of that class.
  • Even if a single method is declared as abstract in a Class ,  the class itself  can be declared as abstract.
  • Abstract class have at least one abstract  method and others may be concrete.
  • In abstract Class the keyword abstract must be used for method.
  • Abstract classes have sub classes.
  • Combination of modifiers Final and Abstract is illegal in java.
 
  • Abstract Class means - Which has more than one abstract method which doesn’t have method body but at least one of its methods need to be implemented  in derived Class.
 
The general form of abstract class is :     
    abstract type name (parameter list);
 
        The Number class in the java.lang package represents the abstract concept of numbers. It makes sense to model numbers in a program, but it doesn't make sense to create a generic number object.

  • Difference  Between Interfaces And Abstract class ?
    • All the methods declared in the Interface are Abstract, where as abstract class must have atleast one abstract method and others may be concrete.
    • In abstract class keyword abstract must be used for method, where as in Interface we need not use the keyword for methods.
    • Abstract class must have Sub class,  where as Interface can’t have sub classes.
    • An abstract class can extend only one class, where as an Interface can extend more than one.
 
What are access specifiers and access modifiers ?
 
Accesss specifiers                                             Access modifiers
Public                                                                     Public
Protected                                                                Abstract             
Private                                                                    Final   
                                                                               Static
                                                                               Volatile                  Constant     
                                                                               Synchronized
                                                                               Transient
                                                                               Native    

  • Public :  The Variables and methods can be access any where and any package.
  • Protected : The Variables and methods can be access same Class, same Package & sub class.
  • Private :  The variable and methods can be access in same class only.
 
Same class                                       -         Public, Protected, and Private
Same-package  & subclass                 -         Public, Protected
Same Package  & non-sub classes       -         Public, Protected
Different package  & Sub classes         -         Public, Protected
Different package  & non- sub classes  -         Public
 
Identifiers : are the Variables that are declared under particular Datatype.
 
Literals: are the values assigned to the Identifiers.

  1. Static : access modifier.  Signa: Variable-Static int b; Method- static void meth(int x)
  • When a member is declared as Static, it can be accessed before any objects of its class are created and without reference to any object. Eg : main(),it must call before any object exit.
  • Static can be applied to Inner classes, Variables and Methods.
  • Local variables can’t be declared as static.                     
  • A static method can access only static Variables. and they can’t refer to this or super in any way.
  • Static methods can’t be abstract.
  • A static method may be called without creating any instance of the class.
  • Only one instance of static variable will exit any amount of class instances.
 
  1. Final : access modifier
  2. All the Variables, methods and classes can be declared as Final.
  3. Classes declared as final class can’t be sub classed.
  4. Method ‘s declared as final can’t be over ridden.
  5. If a Variable is declared as final, the value contained in the Variable can’t be changed.
  6. Static final variable must be assigned in to a value in static initialized block.
 
  1. Transient : access modifier
  2. Transient can be applied only to class level variables.
  3. Local variables can’t be declared as transient.
  4. During serialization, Object’s transient variables are not serialized.
  5. Transient variables may not be final or static. But the complies allows the declaration and no compile time error is generated.
 
  1. Volatile: access modifier
  • Volatile applies to only variables.
  • Volatile can applied to static variables.
  • Volatile can not be applied to final variables.
  • Transient and volatile can not come together.
  • Volatile is used in multi-processor environments.
 
  1. Native : access modifier
  2. Native applies to only to methods.
  3. Native can be applied to static methods also.
  4. Native methods can not be abstract.
  5. Native methods can throw exceptions.
  6. Native method is like an abstract method. The implementation of the abstract class and native method exist some where else, other than the class in which the method is declared.
 
  1. Synchronized : access modifier
  • Synchronized keyword can be applied to methods  or parts of the methods only.
  • Synchronize keyword is used to control the access to critical code in multi-threaded programming.
 
Declaration of access specifier and access modifiers :
 
Class               -   Public,  Abstract,   Final
Inner Class       -   Public, Protected,  Private,  Final,  Static,
Anonymous      -   Public, Protected,  Private,  Static
Variable            -   Public, Protected,  Private,  Final,  Static,  Transient,  Volatile, Native
Method             -   Public, Protected,  Private,  Final,  Abstract, Static,  Native,  Synchronized
Constructor      -   Public,  Protected,  Private
Free-floating code block   -   Static,   Synchronized

  1. Package : A Package is a collection of Classes Interfaces that provides a high-level layer of access protection and name space management.
 

  1. Finalize( ) method:
  • All the objects have Finalize() method, this method is inherited from the Object class.
  • Finalize() is used to release the system resources other than memory(such as file handles& network connec’s.
  • Finalize( ) is used just before an object is destroyed and can be called prior to garbage collection.
  • Finalize() is called only once for an Object. If any exception is thrown in the finalize() the object is still eligible for garbage collection.
  • Finalize() can be called explicitly. And can be overloaded, but only original method will be called by Ga-collect. 
  • Finalize( ) may only be invoked once by the Garbage Collector when the Object is unreachable.
  • The signature finalize( )  :   protected void finalize() throws Throwable {  }
 
  1. Constructor( ) :
  2. A constructor method is special kind of method that determines how an object is initialized when created.
  3. Constructor has the same name as class name.
  4. Constructor does not have return type.
  5. Constructor cannot be over ridden and can be over loaded.
  6. Default constructor is automatically generated by compiler if class does not have once.
  7. If explicit constructor is there in the class the default constructor is not generated.
  8. If a sub class has a default constructor and super class has explicit constructor the code will not compile.
 
  1. Object : Object is a Super class for all the classes. The methods in Object class as follows.
Object clone( )                           final void notify( )          Int hashCode( )
Boolean equals( )                       final void notify( )
Void finalize( )                            String toString( )
Final Class getClass( )                 final void wait( )
  1. Class : The Class class is used to represent the classes and interfaces that are loaded by the JAVA Program.
 
  1. Character : A class whose instances can hold a single character value. This class also defines handy methods that can manipulate or inspect single-character data.
constructors and methods provided by the Character class:
Character(char)  : The Character class's only constructor, which creates a Character object containing the value provided by the argument. Once a Character object has been created, the value it contains cannot be changed.
compareTo(Character) :An instance method that compares the values held by two character objects.
equals(Object) : An instance method that compares the value held by the current object with the value held by another.
toString() : An instance method that converts the object to a string.
charValue() :An instance method that returns the value held by the character object as a primitive char value.
isUpperCase(char) : A class method that determines whether a primitive char value is uppercase.
Powered by Create your own unique website with customizable templates.