0

What's wrong with this code.

class Sample extends Thread { String s; Sample(String n) { this.n = s; } public void run() { System.out.println("Hello "+s); } } class Loader { public static void main(String args[]) { Sample ob1 = new Sample("David Beckham"); Sample ob2 = new Sample("Cristiano Ronaldo"); ob1.start(); ob2.start(); } }

11th Oct 2018, 9:16 AM
Harry Kane
Harry Kane - avatar
1 Respuesta
0
Solved by self. (this.n=s;)
11th Oct 2018, 9:19 AM
Harry Kane
Harry Kane - avatar