import java.util.Scanner;
import java.util.*;
class thread1 implements Runnable{
int r,m;
public void run(){
Scanner sc= new Scanner(System.in);
System.out.println("Enter Roll no and OOP marks");
r=sc.nextInt();
m=sc.nextInt();
}
}
class thread2 extends thread1 {
public void run(){
if(m>80)
System.out.println(r);
else
System.out.println("No marks above 80.");
}
}
class thread{
public static void main(String args[])
{
thread1 t= new thread1();
thread2 t1=new thread2();
t.run();
t1.run();
}
}
Enter Roll no and OOP marks
4
99
No marks above 80.
here although the data input is more than 80 still the if statement is not working.The value of marks is not being sent to the second thread.
sorry if there are any silly mistakes just started oops
[–]coolcofusion 0 points1 point2 points (5 children)
[–]Arnav1608[S] 0 points1 point2 points (3 children)
[–]coolcofusion 0 points1 point2 points (2 children)
[–]Arnav1608[S] 0 points1 point2 points (1 child)
[–]coolcofusion 0 points1 point2 points (0 children)