برنامج Java لتوضيح طريقة بدون Parameters وبنوع Return
- برمجة
- برمجة جافا
- 2021-09-28
- moh2177769644130246
الأجوبة
-
class Box
-
{ -
double width;
-
double height;
-
double depth;
-
double volume()
-
{ -
Scanner s = new Scanner(System.in);
-
System.out.print("enter width : ");
-
double width = s.nextDouble();
-
System.out.print("enter height : ");
-
double height = s.nextDouble();
-
System.out.print("enter depth: ");
-
double depth = s.nextDouble();
-
return width * height * depth;
-
} -
} -
class ReturnDemo -
{ -
public static void main(String args[])
-
{ -
Box cuboid = new Box();
-
double vol;
-
vol = cuboid.volume();
-
System.out.println("Volume is " + vol);
-
} -
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال