السلام عليكم
قال صلى الله عليه وسلم ( من فرج عن أخيه كربة من كرب الدنيا فرج الله عنه كربة من كرب يوم القيامة )
أرجوكم مساعدتي في هذا البرنامج ولكم من صادق الدعاء
Q2) write a java class that corresponding to the following instructions:
1. The class name is AB, which inherited from AC. AB class is a leaf class, means can't be inherited any more. This class can be accessed anywhere.
2. Integer x, y, s as primitive data type. y cannot be accessed from out of its class.
3. The default constructor is initializing x to 0 and y to 0 too.
4. Overload the default constructor with z integer argument; assign the z value to the x value.
5. Write method m1 that has no body;
6. Write method m2 that cannot be override. This method returns the power 2 of x value.
7. Write method m3 that has no arguments, it just assign 5 to s, and returns s.
In side the main method initialize the s data type to = zero, then call m3 and println s.
وهذي محاولتي علما بأني شغال بهذا البرنامج من اسبوع
}
abstract final AB extends AC {
int x;
int y;
praivate int s;
AB (int x , int y) {
x=0 ;
x=0 ;
}
AB(praivate int z ){
x=z;
}
abstract void m1 ();
final int m2 (int x )
{ return ( math.pow(x,2));
}
m3 () {
int s = 5 ;
return s ;
}
}
public class BC {
public static void main (String args []){
int s = 0 ;
m3 ();
System.out.println(s);
}
}
class AC {