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. Can there be an abstract class with no abstract methods in it?

    Answer: Yes

  2. Can an Interface be final?

    Answer: No

  3. Can an Interface have an inner class?

    Answer: Yes.

  4. Can we define private and protected modifiers for variables in interfaces?

    Answer: No

  5. What is Externalizable?

    Answer: Externalizable is an Interface that extends Serializable Interface.And sends data into Streams in Compressed Format.It has two methods:

    • writeExternal(ObjectOuput out)
    • readExternal(ObjectInput in)

  6. What modifiers are allowed for methods in an Interface?

    Answer: Only public and abstract modifiers are allowed for methods in interfaces.

  7. What is a local, member and a class variable?

    Answer: Variables declared within a method are local variables.
    Variables declared within the class i.e not within any methods are member variables (global variables).
    Variables declared within the class i.e not within any methods and are defined as static are class variables

  8. What are the different identifier states of a Thread?

    Answer: The different identifiers of a Thread are:

    • R - Running or runnable thread
    • S - Suspended thread
    • CW - Thread waiting on a condition variable
    • MW - Thread aiting on a monitor lock
    • MS - Thread suspended waiting on a monitor lock

  9. What are some alternatives to inheritance?

    Answer: Delegation is an alternative to inheritance.Delegation means that you include an instance of another class as an instance variable, and forward messages to the instance.It is often safer than inheritance because it forces you to think about each message you forward, because the instance is of a known class, rather than a new class, and because it doesnt force you to accept all the methods of the super class: you can provide only the methods that really make sense.On the other hand, it makes you write more code, and it is harder to re-use (because it is not a subclass).

  10. Why isnt there operator overloading?

    Answer: Because C++ has proven by example that operator overloading makes code almost impossible to maintain.In fact there very nearly wasnt even method overloading in Java, but it was thought that this was too useful for some very basic methods like print().Note that some of the classes like DataOutputStream have unoverloaded methods like writeInt() and writeByte().

« 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.