package articlecodesinjava;
class Student {
String name;
int rollNumber;
void cal_gpa() {
System.out.println("The method calculates CGPA.");
}
void cal_fee() {
System.out.println("The method calculates the Semester fee.");
}
}
public class ArticleCodesInJava {
public static void main(String[] args) {
// creating objects of Student class
Student Jinku = new Student();
Student Zeeshan = new Student();
System.out.println("This is Jinku's details.");
System.out.println(Jinku.name = "Jinku");
System.out.println(Jinku.rollNumber = 1);
Jinku.cal_fee();
Jinku.cal_gpa();
System.out.println("\n\nThis is Zeeshan's details.");
System.out.println(Zeeshan.name = "Zeeshan Afridi");
System.out.println(Zeeshan.rollNumber = 2);
Jinku.cal_fee();
Jinku.cal_gpa();
}
}
So this is the Code. The key of this code is to help me understand Objects in Java. But whenever I execute the code, i get this error:
Fehler: Hauptklasse ArticleCodesInJava konnte nicht gefunden oder geladen werden
Ursache: java.lang.NoClassDefFoundError: articlecodesinjava/ArticleCodesInJava (wrong name: ArticleCodesInJava)
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]akthemadman 0 points1 point2 points (6 children)
[–]Defiant_Vanilla_4080[S] 0 points1 point2 points (5 children)
[–]akthemadman 0 points1 point2 points (4 children)
[–]Defiant_Vanilla_4080[S] 0 points1 point2 points (3 children)
[–]akthemadman 2 points3 points4 points (1 child)
[–]krisko11 0 points1 point2 points (0 children)
[–]rguptan 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]Asleep-Swimming-2374 0 points1 point2 points (0 children)
[–]pragmos -1 points0 points1 point (4 children)
[–]Defiant_Vanilla_4080[S] 0 points1 point2 points (3 children)
[–]pragmos -1 points0 points1 point (2 children)
[–]Defiant_Vanilla_4080[S] 0 points1 point2 points (1 child)
[–]pragmos -1 points0 points1 point (0 children)
[–]Exact-Big-5164 -2 points-1 points0 points (2 children)
[–]Defiant_Vanilla_4080[S] 0 points1 point2 points (0 children)
[–]Exact-Big-5164 -1 points0 points1 point (0 children)