Abstract class Interface 1) An abstract class can have method body (non-abstract methods). Interface have only abstract methods. 2) An abstract class can have instance variables. An interface cannot have instance variables. 3) An abstract class can have constructor. Interface Read More …
Category: Java
What is Variable and Types of variable in Java ?
Variable : is name of reserved area allocated in memory. for ex. int data=50; // here data is variable Types of Variable : Local variable Instance variable Static variable Local variable : declared inside the method . Instance variable : declared inside Read More …
Program to check Prime Numbers in Java (Java Code)
package flizz; /** * * @author Abhay */ public class CheckPrime { public static void main(String args[]){ int i,m=0,flag=0; int n=17;//it is the number to be checked m=n/2; for(i=2;i<=m;i++){ if(n%i==0){ System.out.println(“Number is not prime”); flag=1; break; } } if(flag==0) System.out.println(“Number Read More …
What is Data Type in Java ?
A Data Type in programming language is a set of data with values having predefined characteristics. There are mainly two types of Data Type : Primitive Data Type Non-primitive Data Type Primitive Data Type : boolean 1-bit char 2-bytes byte 1-byte Read More …
What is Java Virtual Machine (JVM) ?
JVM stands for Java Virtual Machine . JVM is an abstract computing machine that enables a computer to run a Java program. JVM perform following main tasks : Loads Code Verifies Code Executes Code Provides runtime environment A specification where working Read More …
What is the difference between final , finally and finalize ?
There are so many differences between final , finally and finalize in java language. important differences are given below Final Finally Finalize It is a Keyword It is a Block It is a Method It is used to apply restrictions Read More …