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. How many ways can you represent integer numbers in JAVA?

    Answer: There are three ways , you can represent integer numbers in JAVA.They are decimal (base 10) , octal (base 8) , and hexadecimal (base 16).

  2. A note on defining floating point literal?

    Answer: A floating point literal is defined as float g = 3576.2115F.

  3. A note on arrays of object references?

    Answer: A11.If the array type is CLASS then one can put objects of any subclass of the declared type into the array.
    The following example on sports explains the above concept:

    class sports { }

    class football extends sports { }

    class hockey extends sports { }

    class baseball extends sports { }

    sports [ ] mysports = { new football (),

    new hockey (),

    new baseball ()};

  4. What is meant by "instanceof" comparison?

    Answer: It is used for object reference variables only.You can use it to check wether an object is of a particular type.

  5. Wen is a method said to be overloaded?

    Answer: Two or more methods are defined within the same class that share the same name and their parameter declarations are different then the methods are said to be overloaded.

  6. What is meant by Recursion?

    Answer: It is the process of defining something in terms of itself.Interms of JAVA it is the attribute that allows a method to call itself.

    The following example of calculating a factorial gives an example of recursion. class Factorial {

    int fact (int n) {

    int result;

    if (n= 1) return 1;

    result = fact(n -1) * n;

    return result;

    }

    }

    class Recursion {

    Public static void main (string args[ ]) {

    Factorial f = new Factorial ();

    system.out.println ("Factorial of 10 is " + f.fact(10));

    }

    }

  7. A cool example to explain the concept of METHOD in JAVA.

    Answer: Let us say you are in Mcdonalds and you order for #7 for here with medium coke.The cashier takes your order and punches it on the computer.The folks in the kitchen get the order and they get the crispy chicken and pass it on to the guy who puts a medium fries and finally a medium coke is filled and the order is served to you.In other terms if all this was supposed to be done by a robot then it could have been programmed the following way. void #7forherewithmediumcoke( )

    {

    Get (crispy chicken, lattice, butter, fries, coke);

    make (sandwich);

    fill (coke, fries);

    }

« Previous

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.