Java Program on Generic Methods
DataFlair
by test001
1d ago
Program 1 package dataflair; class MyGen<T extends Number> { T ar[]; MyGen(T ar[]) { this.ar=ar; } void sumofElements() { double s=0.0; for(int i=0;i<ar.length;i++) { s=s+ar[i].doubleValue(); } System.out.println("Sum of elements is: "+s); } } public... The post Java Program on Generic Methods appeared first on DataFlair ..read more
Visit website
Java Program on Bounded Generic
DataFlair
by test001
1d ago
Program 1 package dataflair; class MyClass<T extends Number> { T n; MyClass(T n) { this.n=n; } public String toString() { return " "+n; } } public class TestMain { public static void main(String[] args)... The post Java Program on Bounded Generic appeared first on DataFlair ..read more
Visit website
Java Program on Generic Classes
DataFlair
by test001
1d ago
Program 1 package dataflair; import java.util.*; class MyClass<T> { T n; MyClass(T n) { this.n=n; } public String toString() { return (" "+n); } } public class TestMain { public static void main(String[] args)... The post Java Program on Generic Classes appeared first on DataFlair ..read more
Visit website
Java Program on Difference Between call by value and call by reference
DataFlair
by test001
1d ago
Program 1 package dataflair; class Abc { int n; void increment(Abc M) // reference { M.n=700; } } public class TestMain { public static void main(String[] args) { int n=200; Abc A=new Abc(); System.out.println("Before... The post Java Program on Difference Between call by value and call by reference appeared first on DataFlair ..read more
Visit website
Java Program on Maxvalue Minvalue type size
DataFlair
by test001
1d ago
program 1 package dataflair; public class TestVariables { public static void main(String[] args) { System.out.println("Byte Details"); System.out.println(Byte.TYPE); System.out.println(Byte.SIZE); System.out.println(Byte.MAX_VALUE); System.out.println(Byte.MIN_VALUE); System.out.println("Short Details"); System.out.println(Short.TYPE); System.out.println(Short.SIZE); System.out.println(Short.MAX_VALUE); System.out.println(Short.MIN_VALUE); System.out.println("Integer Details"); System.out.println(Integer.TYPE); System.out.println(Integer.SIZE); System.out.println(Integer.MAX_VALUE); System.out ..read more
Visit website
Java Program on User Define Wrapper Classes
DataFlair
by test001
1d ago
Program 1 package dataflair; public class MyClass { private byte n; public static final int SIZE=8; public static final String TYPE="byte"; public static final int MAX_VALUE=127; public static final int MIN_VALUE=-128; public MyClass() {... The post Java Program on User Define Wrapper Classes appeared first on DataFlair ..read more
Visit website
Java Program on Wrapper Classes
DataFlair
by test001
1d ago
Program 1 package dataflair; public class TestMain { public static void main(String[] args) { //int a=500; // Integer I=new Integer(500); //Boxing // System.out.println(I); // Integer I1=800; //Autoboxing // // Unboxing Integer I=new Integer(130); int... The post Java Program on Wrapper Classes appeared first on DataFlair ..read more
Visit website
Java Program on Character Wrapper Class
DataFlair
by test001
1d ago
Program 1 package dataflair; public class TestCharacter { public static void main(String[] args) { // Character C1=new Character('A'); // Character C2=97; // System.out.println(C1); // System.out.println(C2); // System.out.println(Character.isLetter('A')); //true // System.out.println(Character.isLetter('a')); //true // System.out.println(Character.isLetter(65)); //true... The post Java Program on Character Wrapper Class appeared first on DataFlair ..read more
Visit website
Java Program on Wait Notify in Multithreading
DataFlair
by test001
1d ago
Program 1 package dataflair; import java.util.ArrayList; public class MyThread extends Thread { int sum=0; public void run() { synchronized(this) { System.out.println("This is MyThread Thread Starts"); int i; for(i=1;i<=1000;i++) { sum=sum+i; } this.notify(); System.out.println("This is... The post Java Program on Wait Notify in Multithreading appeared first on DataFlair ..read more
Visit website
Java Program on Block Synchronization
DataFlair
by test001
1d ago
Program 1 // Outer resource method package dataflair; public class MyTable { void showTable(int n) { System.out.println("Data Flair Free Coruse"); System.out.println("Wel come you all in Data Flair Free Coruse"); synchronized(this) { try { int... The post Java Program on Block Synchronization appeared first on DataFlair ..read more
Visit website

Follow DataFlair on FeedSpot

Continue with Google
Continue with Apple
OR