Differences Between Abstract Class and Interface

Abstract class:

Abstract class must have at least one abstract method. 
Abstract keyword must be used for all the methods.
Abstract class must have subclass.



Interface: 

Inheritance is possible in interface.
Variables value must be defined in interface.
Many interface can be implemented by a single class.
Methods can be defined in interface and used in class.



Abstract classes are used when they have some sharable implementations and some specific methods left to subclasses to implement. Interface is used when there are no sharable implementation and the implementation changes frequently.

Abstract class can have methods which are abstract or not abstract. All methods of interface should be implemented unless the implementation is an abstract class.

Abstract class can be subclassed interface class can be implemented

Abstract Class or Method


Question:
Can we make use of "this" keyword reference inside a abstract method or Abstract Method?
Answer:
Yes You Can do that
For Example:
public abstract class TestExample{

private String exampleid;

private String examplename;

public TestExample(String exampleid ,String examplename)

{

this.exampleid= exampleid;

this.examplename= examplename;

}

//public gettors and settors

public abstract void scheduleTest();

}


public class JavaTestExample extends TestExample

{

private String typeName;

public JavaTestExample(String exampleid, String examplename, String typeName)

{

super(exampleid, examplename);

this.typeName =typeName;

}

public void scheduleTest()

{

//do Stuff

}

}



A class has a constructor so that when an instance of the Class is created
the fields of the class can be setup to a initial valid state.

Abstract classes define partial implementation of a public contract. Which
means that it may implement some of the methods and contains partially
implemented methods that are marked abstract.

Since abstract classes can have partial implementation and such partial
implementation can include fields of the class a constructor becomes necessary
so that those fields are initialized to a valid default state when they are
created thru the constructor of their concrete subclasses.

All abstract class are not pure abstract partially they are. So if you
need a pure abstract class go for an Interface.

JMS Interview Questions

JMS Interview Questions coming soon.....

JDBC Interview Questions

JDBC Interview Questions coming soon...

JSP Interview Questions

JSP Interview Questions Coming soon.....

Websphere Interview Questions

Websphere Interview Questions Coming Soon...

Struts Interview Questions

Struts Interview Questions Coming Soon...

J2EE Interview Questions


1)What is J2EE?

2)What is the J2EE module?

3)What are the components of J2EE application?

4)What are the four types of J2EE modules?

5)What does application client module contain?

6)What does Enterprise JavaBeans module contain?

7)What does resource adapt module contain?

8)How many development roles are involved in J2EE application?

9)What is difference between J2EE 1.3 and J2EE 1.4?

10)Is J2EE application only a web-based?

11)Are JavaBeans J2EE components?

12)Is HTML page a web component?

13)What is the container?

14)What is the web container?

15)What is the thin client?

16)What are types of J2EE clients?

17)What is deployment descriptor?

18)What is the EAR file?

19)What are JTA and JTS?

20)What is JAXP?

21)What is J2EE Connector?

22)What is JAAP?

23)What is Model 1?

24)What is Model 2?

25)What is Struts?

26)How is the MVC design pattern used in Struts framework?

27)Do you have to use design pattern in J2EE project?

28)Is J2EE a super set of J2SE?

29)What does web module contain?

30)What APIs are available for developing a J2EE application?



Core Java Interview Questions

Coming soon........

How to Convert HTML page into Image

U can convert Static URL to HTML code( HMTL content).
public String URLReader(String myurl) throws Exception {
//System.out.println("inside util");
String returnLine = "" ;
try{
String inputLine = "" ;
if(myurl != null && !myurl.equals(""))
{
URL url = new URL(myurl) ;
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())) ;
while ((inputLine = br.readLine()) != null)
{
returnLine=returnLine+inputLine;
}
br.close();
}
}catch(Exception e)
{
//throw e;
}
return returnLine;
}

Java Architecture Diagram

Java Virtual machine-JVM Internal Architecture


To understand the Java virtual machine you must first be aware that you may be talking about any of three different things when you say "Java virtual machine." You may be speaking of:
  • the abstract specification,
  • a concrete implementation, or
  • a runtime instance.
The abstract specification is a concept, described in detail in the book: The Java Virtual Machine Specification, by Tim Lindholm and Frank Yellin. Concrete implementations, which exist on many platforms and come from many vendors, are either all software or a combination of hardware and software. A runtime instance hosts a single running Java application.Each Java application runs inside a runtime instance of some concrete implementation of the abstract specification of the Java virtual machine. In this book, the term "Java virtual machine" is used in all three of these senses. Where the intended sense is not clear from the context, one of the terms "specification," "implementation," or "instance" is added to the term "Java virtual machine".

The Architecture of JVM

J2EE Tutorial-An Introduction


The Java language is such that it allows cross-platform communication between multiple kinds of devices. For example, a programmer can develop Java code on a desktop computer and expect it to run on other computers, routers, and even mobile phones, as long as those devices are Java-enabled. This portability is described by the Sun acronym WORA, which stands for "Write once, run anywhere." A large number of mainframes, computers, mobile phones, and other electronic devices operate using the Java Platform.
The 2 in the acronym J2EE stands for Version 2. As with many software applications, J2EE is Java Platform Version 2. Actually, the number 2 is often dropped nowadays, so J2EE becomes Java EE. Traditionally, though, it's still J2EE.
Now, on to the EE. It stands for Enterprise Edition, which is a powerful form of the Java Platform. Sun has created three editions so far. The most precise is the Micro Edition, which is used for mobile phones and PDAs. Following form, this can be abbreviated as Java ME.
The middle edition is the Standard Edition, which can run on mobile devices, laptops and desktop computers. The abbreviated name of this edition is Java SE. Building our way up the pyramid, we come at last to the Enterprise Edition, which includes all the functionality of the Micro Edition and the Standard Edition and also features routines and subroutines designed specifically for servers and mainframes.