how can i "integrate" these two classes to add no1 and no2?
i have mainprog as,
and numadd as,
i have mainprog as,
Code:
import java.io.* ;
public class testprog {
static int no1, no2 ;
public static void main (String args[]) throws IOException
{
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
System.out.print ("First no: ") ;
no1 = Integer.parseInt(br.readLine()) ;
System.out.print ("Second no: ") ;
no2 = Integer.parseInt(br.readLine()) ;
}
}
and numadd as,
Code:
class numadd extends testprog {
public static void main (String args[])
{
double sum = 0.0 ;
sum = no1 + no2 ;
System.out.println ("Sum is "+sum);
}
}