Skip to main content

Posts

Showing posts with the label basics

Difference between Abstract Class and Interface

Difference between Abstract Class and Interface Difference between abstract class and interface ? Abstract Class:- 1) Can have abstract and non-abstract method both. 2) One class can extend at most one class. 3) can declare non abstract method and also can define body for it. Interface:- 1) can have only abstract method. 2) One class can implement multiple interfaces. 3) can't delare body to a method. Please look below example for more understanding:- package Basics ; public abstract class Animal { int head ; //no body (unimplemented function need to override in child class as a //compulsion abstract void setLegs (); //having body //may override or may not void setHead () { head =1; } } package Basics ; // can have only methods and by default all are abstract need to be override //by implementing class, unlike abstract no method can havedefinition public interface Pet { void tellWhereAreYouFr...

basics of java in layman term for beginner

Basics of java in layman term for beginner What is an object ? object is a real world entity. Object is an instance of the class.It means something that is alive. Let us take an example of CAR:- concept of a car is class. I mean we all know that it is having four tyres , one engine , four doors , a seat e.t.c. but we can't do anything just by the concept we need real Car to perform operations on it . This real car is what we call is an object. Explain about main() method in java ? main() method is an entry point of a program. public static void main(String[] args) Why main() method is public, static and void in java ? public: It can be accessed from anywhere. static: no class object need to call this method. void: it is not returning anything in back. What is JIT compiler ? JIT is just in time compiler.JIT compiler runs after the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-...

.