the wrapper class answer coming soon.....
Sunday, 4 September 2011
What is the initial state of a thread when it is created and started?
the thread initial state answer coming soon......
Why threads block or enters to waiting state on I/O?
the thread blog or enters to waiting state in I/O answer comming soon........
Tuesday, 30 August 2011
Monday, 29 August 2011
whai is set interface?
Ans:
It has two useful concrete classes that implements sets
Example:
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
public class SetExample {
public static void main(String[] args) {
// Set example with implement TreeSet
Set<String> s=new TreeSet<String>();
s.add("b");
s.add("a");
s.add("b");
Iterator it=s.iterator();
while(it.hasNext())
{
String value=(String)it.next();
System.out.println("Value :"+value);
}
}
}
Output
Set Value :a
Set Value :b
set ignore the duplicate value.
- Java collections Set interface is part of java.util package.
- A set is a public interface that extends the collection interface
- It holds unique values(set does not contain duplicate elements).
It has two useful concrete classes that implements sets
- java.util.HashSet
- Set value can get by Iterator interface.
Example:
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
public class SetExample {
public static void main(String[] args) {
// Set example with implement TreeSet
Set<String> s=new TreeSet<String>();
s.add("b");
s.add("a");
s.add("b");
Iterator it=s.iterator();
while(it.hasNext())
{
String value=(String)it.next();
System.out.println("Value :"+value);
}
}
}
Output
Set Value :a
Set Value :b
set ignore the duplicate value.
what is an interface?
Ans:
syntax:
interface interface name{
//declaration of methods and constants
}
class class name implements{
//implementation codes
}
- An interface is a named collection of method declarations and constant declarations.
- here we only declare the methods not a implementation.
- it's implemented by a class using implements keyword.
syntax:
interface interface name{
//declaration of methods and constants
}
class class name implements{
//implementation codes
}
what is inheritance?
Ans:
syntax:
class A{
//class A codes
}
class B{
//class B codes and also use class A members
}
- Java Inheritance defines an is-a relationship between a superclass and its subclasses.
- The child class can use the methods and variables of the superclass and add to them its own methods and variables .
- The keyword extends is used by the sub class to inherit the features of super class .
- Using inheritance we can achieve the concepts of reusability.
syntax:
class A{
//class A codes
}
class B{
//class B codes and also use class A members
}
what is polymorphism?
Ans:
There are two types of polymorphism,
- ablity to make more then one form for same function.
- ability to process objects differently depending on their data type or class
- the characteristic of being able to assign a different meaning or usage for same function.
- it's used to code reusability.
There are two types of polymorphism,
- overloading
- overriding
what is encapsulation?
Ans:
- java encapsulation is wrapping up of the data into single unit.
- The process of hiding all the details of an object that do not contribute to its essential characteristics
- for example if we declare the members(variable or method) public then we access the members into anywhere, but if we declare the private then we cant access the members out of class this is called encapsulation.
what is abstraction
Ans:
- Java Abstraction means to show only the necessary details to the client of the object .
- without knowing the background of details we use.
- it is usually accomplished through the use of base classes with virtual functions , each derived function provides the details that implement the behavior behind that abstraction
what is class?
Ans:
syntax:
class classname{
//tour own code
}
- java class is a specification of how to construct something and also called template.
- Java classes contain multiple fields , variables and methods.
- The structure of a class and its subclasses is called the class hierarchy.
syntax:
class classname{
//tour own code
}
what is an object?
Ans:
Three properties characterize objects:
Syntax:
ClassName object ;
(or)
ClassName object = new ClassName;
- Object is a run time entity.
- A set of data combined with methods for manipulating
Three properties characterize objects:
- Identity
- State
- Behavior
Syntax:
ClassName object ;
(or)
ClassName object = new ClassName;
what is java? (or) define java?
Ans:
Advantages:
- java is a high level programming language developed by James Gosling for Sun Microsystems.
- java was originally called OAK ,later the name changed.
- java is a neutral platform language(support all platform).
- java is a Object Oriented Programming language.
- java mainly developed by mobile device and internet.
Advantages:
- Easy to Use
- Reliability
- Secure
- Platform Independent
java interview questions
- What is the difference between procedural and object-oriented programs?
- what is java? or define java?
- What is the difference between Assignment and Initialization?
- What is an Iterator?
- What is casting?
- what is static method?
- What is final, finalize() and finally?
- what is final?
- How many ways can an argument be passed to a subroutine and explain them?
- what id the meaning of final in variable , method and class?
- What is OOPs?What is an Object and how do you allocate memory to it?
- What is the difference between constructor and method?
- what is class?
- What is the difference between this() and super()?
- What is the difference between an argument and a parameter?
- What is an abstract class?
- what is encapsulation?
- What is daemon thread and which method is used to create the daemon thread?
- What is meant by pass by reference and pass by value in Java?
- What are wrapper classes?
- what is polymorphism?
- Explain the usage of Java packages.
- What is difference between overloading and overriding?
- What is the purpose of garbage collection in Java, and when is it used?
- what is thread?
- what is inheritance?
- What is the difference between superclass and subclass?
- what is interface?
- What is JDBC?
- What is the difference between JDBC and ODBC?
- What are drivers available?
- what is swing?
- what is diff between swing and awt?
- What are the types of statements in JDBC?
- What are the steps involved for making a connection with a database or how do you connect to a database?
23:15
admin