Shared Flashcard Set

Details

Java Key Concepts 1
N/A
11
Computer Science
Undergraduate 1
05/13/2014

Additional Computer Science Flashcards

 


 

Cards

Term
What is the difference between static methods and instance methods?
Definition
instance method belongs to the instance of a class therefore it requires an instance before it can be invoked, whereas static method belongs to the class itself and not to any class instance so it doesn’t need an instance to be invoked.
Term
Can static block throw exception?
Definition
Yes, static block can throw only Runtime exception or can use a try-catch block to catch checked exception
Term
What is difference between abstract class and interface?
Definition
A class is called abstract when it contains at least one abstract method. Interface can contain only abstract( non implemented) methods.
Term
describe when to use abstract class and interface?
Definition
When we talk about abstract classes we are defining characteristics of an object type, specifying what an object is but in the case of an interface we define a capability and we bond to provide that capability, we are talking about establishing a contract about what the object can do.
Term
Does java support multiple inheritance?
Definition
Java doesnt support multiple inheritance.
Term
Can the this keyword be assigned a null value?
Definition
No
Term
What are the different types of references in java?
Definition
Strong Reference, Soft Reference ,Weak Reference ,Phantom Reference
Term
Does java support pass by value or pass by reference?
Definition
Java supports only pass by value
Term
what is pass by value?
Definition
you are passing a copy of the variable.
Term
what is pass by reference?
Definition
you are passing a pointer to the variable
Term
What is the difference between equals() and ==?
Definition
== operator is used to compare the references of the objects.
equals() method can be used to compare the values of two objects
Supporting users have an ad free experience!