I just looked through some Java code and I came across the following program
public class LengthOfString extends Thread {
static String s;
public void run(){
System.out.println("You Have Enter String: " + s +" Length Of It is :" + s.length());
}
public static void main(String[] args) throws InterruptedException {
s = "This IS String";
LengthOfString h = new LengthOfString();
Thread t = new Thread(h);
t.start();
}
}
I realized that it is used to print the length of a line, but I have a problem understanding the commented line. Please help me understand why this implementation was used.
source
share