Fibonacci Series In Java
class Fibonacci { public static void main(String args[]) { int a=1,b=1,c; System.out.println(+a); System.out.println(+b); for(int i=1;i<=10;i++) { c=a+b; System.out.println(+c); a=b; b=c; } } } Output: 1 1 2 3 5…
Java concepts and programs
class Fibonacci { public static void main(String args[]) { int a=1,b=1,c; System.out.println(+a); System.out.println(+b); for(int i=1;i<=10;i++) { c=a+b; System.out.println(+c); a=b; b=c; } } } Output: 1 1 2 3 5…
When a function with the same name and in the base and derived class is there then the base class function will be overridden(Means Ignored. Example of Method Overriding: class…
If a class has multiple methods with the same name but different in parameters is called method overloading. By changing the number of arguments: class MOL { static int…
import java.util.Scanner; class Mobile { String name; int rate; String color; String version; String search; static int i; static int ntamt; public static void main(String args[]) { Mobile m[]=new Mobile[5];…
Inheritance is the process by which object of one class acquires the properties of the object of another class. The class from which properties are inherited is called base class…
This keyword is used to refer to the current class instance variable. This keyword is used to invoke the current class method. This keyword is used to invoke the current…
The static keyword is mainly used for memory management only. The static keyword can be used with. Variables Methods Block Nested Class The property of the static is shared among…
In Java, the constructor is a block of codes similar to the method. The constructor is called when the instance of the object is created. The constructor is a special method…
The continue statement is used to jump to the next iteration of the loop immediately. class Continue1 { public static void main(String[] args) { for(int i=1;i<=10;i++) { if(i==5) { continue;…
The break statement is used to terminate the loop immediately and the program continues from the next statement. class Break1 { public static void main(String[] args) { for(int i=1;i<=10;i++) {…