class Marks {
private int mark1;
private int mark2;
private int mark3;
public Marks() {
this.mark1 = 0;
this.mark2 = 0;
this.mark3 = 0;
}
public Marks(int mark1, int mark2, int mark3) {
this.mark1 = mark1;
this.mark2 = mark2;
this.mark3 = mark3;
}
public int markSum() {
return mark1 + mark2 + mark3;
}
}
class App {
public static void main(String[] args) {
Marks marks = new Marks(50, 60, 80);
System.out.println("Marks sum: " + marks.markSum());
}
}
Comments
Leave a comment