Ist es moglich? (Ich denke - schon!)
Aber welche Nahme hat dann ?.java - datei? Von die Classe mit main Methode?
und warum Compilator gibt dann Fehler aus?
public class LKW
{
public int kw;
public String hersteller;
}
public class CbR
{
public static void kwplusplus (LKW l)
{
l.kw++;
System.out.print(l.kw +"kw");
}}
class CbRBeispiel
{
public static void main(String[]args)
{
LKW tieflader = new LKW(); // LKW findet hier auch nicht! Warum?
tieflader.kw = 500;
tieflader.hersteller = "MAN";
System.out. println("Der LKW von" + tieflader.hersteller +"hat:");
System.out.println(tieflader.kw + "kw(vorher)");
GbR.kwpusplus(tieflader); // findet auch nicht!
}}
Danke!
Aber welche Nahme hat dann ?.java - datei? Von die Classe mit main Methode?
und warum Compilator gibt dann Fehler aus?
public class LKW
{
public int kw;
public String hersteller;
}
public class CbR
{
public static void kwplusplus (LKW l)
{
l.kw++;
System.out.print(l.kw +"kw");
}}
class CbRBeispiel
{
public static void main(String[]args)
{
LKW tieflader = new LKW(); // LKW findet hier auch nicht! Warum?
tieflader.kw = 500;
tieflader.hersteller = "MAN";
System.out. println("Der LKW von" + tieflader.hersteller +"hat:");
System.out.println(tieflader.kw + "kw(vorher)");
GbR.kwpusplus(tieflader); // findet auch nicht!
}}
Danke!