Write the definition of a method named copy receives a reference to a Scannerobject associated with a stream of input. The method reads all the Strings remaining to be read from the stream and displays them, one on a line with no other spacing, onto standard output .
this is my code, it doesn't work:
public static void String copy(Scanner obj){
String str1;
String str2;
if(!obj.hasNext()){
str2 = copy(obj);
str1 = obj.next();
System.out.println(str2);
}
}