Import Public Class Public Static Void New
Import Public Class Public Static Void New
Find whether hashSet is empty or not and find hashSet object is there or not.
import java.util.*;
h.add("Java");
h.add("is");
h.add("easy");
Output:
import java.util.*;
void print()
{
System.out.println("Value of a= "+a);
System.out.println("Value of a= "+b);
System.out.println("Value of a= "+c);
}
}
Output:
Value of a= 10
Value of a= 20
Value of a= 30
Does object 'b2' exists in the list= true
Is object 'b2' equal to object 'b1'= false
Q43.) Write a program which attempts to write “Hello World” to a file. After
writing, the program attempts to read the string “Hello World” from the
same file and prints it to the screen.
package javaprograms;
import java.io.*;
public class File1 {
}
}
Output:
Hello World