Sample Questions Best site for GRE, LSAT, SAT, GMAT, TOEFL, CCNA, CCSA and interview sample questions  

Technical Sample Questions : C |  C++ |  Oracle |  Java | Unix |  Operating Systems |  Data Structure

Java Sample Questions ›› Core Java Sample Questions

Technical Sample Questions : Java Sample Questions : Core Java Sample Questions

  1. Describe the wrapper classes in Java.

    Answer: Wrapper class is wrapper around a primitive data type.An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type.

  2. Describe primitive types and the corresponding wrapper classes

    Answer: The primitive types and the corresponding wrapper classes are listed below:

    Primitive Wrapper
    boolean java.lang.Boolean
    byte java.lang.Byte
    char java.lang.Character
    double java.lang.Double
    float java.lang.Float
    int java.lang.Integer
    long java.lang.Long
    short java.lang.Short
    void java.lang.Void

  3. Describe the three OOPS principles?

    Answer: These are as follows:

    • Encapsulation:It is the way the code and data are confined and are in isolation from the outside environment of the system.
    • Inheritance:It is the process by which one object acquires the properties of another object.
    • Polymorphism:It is a feature that allows one interface to be used for a general class of actions.The specific action is determined by the exact nature of the situation.

  4. What is meant by Endianness?

    Answer: Endianness describes how multiple data types such as short , int and long are stored in memory.If it takes two bytes to represent a short, then to predict if the most significant or the least significant comes first.If the most significant byte is first, followed by the least significant one then the machine is said to be big endian.Machines such as the SPARC and Power PC are big-endian, while the Intel x86 series is little-endian.

  5. How many types of literals are there in JAVA?

    Answer: There are four types of literals they are Integer literals, Floating point literals, Boolean literals and character literals.

  6. A note on compiling & Executing a JAVA pgm

    Answer: The steps are as follows:

    • The name of the sourcefile is called in terms of.java
    • A source file is called a compilation unit.This has one or more class definitions.
    • The name of the class should be same as that of the file.
    • Once compiled the.java file creates a.class file.This is done by the compiler javac
    • This classfile contains the bytecode version of the program.

  7. A note on PUBLIC , PRIVATE , STATIC , VOID & MAIN.

    Answer: followig are some points:

    • All Java applications begin execution by calling main ()
    • When a class member is defined as public.Then that member may be accessed by code outside the class in which it is declared.
    • The opposite of public is private which prevents a member from being used by code defined outside of its class.
    • The keyword static allows main() to be called without having to instantiate a particular instance of the class.This is mandatory because main () is called by the Java interpreter before any objects are made.
    • CASE SENSITIVE : Main () is different from main().It is important to know that that Main() would be compiled.But the Java interpreter would report an error if it would not find main().

  8. What is meant by Garbage collection?

    Answer: The technique that automatically destroys the dynamically created objects is called garbage collection.When no reference to an object exists, that object is assumed to be no longer needed , and memory occupied by that object can be reclaimed.

  9. What are the access modifiers?

    Answer: There are three types of access modifiers.

    • Private - Makes a method or a variable accessible only from within its own class.
    • Protected - Makes a method or a variable accessible only to classes in the same package or subclasses of the class.
    • Public - Makes a class , method or variable accessible from any other class.

  10. A note on keywords for Error handling.

    Answer: Error Handling is explained as:

    • Catch:Declares the block of code used to handle an exception.
    • Finally:Block of code , usually following a typecatch statement, which is executed no matter what program flow occurs when dealing with an exception.
    • Throw:Used to pass an exception up to the method that calls this method.
    • Throws:Indicates the method will pass an exception to the method that called it.
    • Try:Block of code that will be tried but which may cause an exception.
    • Assert:Evaluates a conditional _expression to verify the programmer's assumption.

« Previous || Next »

Core Java Sample Question Number : 1-10| 11-20| 21-30| 31-40| 41-50| 51-60| 61-70| 71-80| 81-87|
Sample Test Questions
GRE Sample Questions
CAT Sample Questions
GMAT Sample Questions
TOEFL Sample Questions
ACT Sample Questions
SAT Sample Questions
LSAT Sample Questions
PSAT Sample Questions
MCAT Sample Questions
PMP Sample Questions
GED Sample Questions
ECDL Sample Questions
DMV Sample Questions
CCNA Sample Questions
MCSE Sample Questions
Network+ Sample Questions
A+ Sample Questions
Technical Sample Questions
WASL Sample Questions
CISA Sample Questions

Other Sample Questions
Sample Interview Questions
Sample Teacher Interview Questions
Sample Citizenship Questions
Accuplacer Sample Questions
Science Bowl sample Questions
Driving Test Sample Questions
Sample Survey Questions Sample Essay Questions
Sample Behavioral Interview Questions

Copyright © 2004-2013, Best BSQ. All Rights Reserved.