Mein Problem betrifft die Anwendung von Static-Schlüsselwort für eine Klasse. Wie es einfach ist, statische Schlüsselwort für Instanzvariablen und Methoden aber anzuwenden, während es zu den Klassen kommt, funktioniert es nicht. schließlich helfen Sie mir bitte den CodeAnwenden von statischen Schlüsselwort auf eine Klasse in Java
static class Box{
static int width,depth,height;
static void volume(int w,int d,int h){
double vol=w*d*h;
System.out.println(vol);
}
}
class ClassStaticTest{
public static void main(String[] args){
//Box b=new Box();
width=10;
height=10;
depth=10;
Box.volume(10,10,10);
}
}
Was erwarten Sie von ihm? – Hackerdarshi