I cannot figure out why i keep getting this error for illegal start of expressio
ID: 3893202 • Letter: I
Question
I cannot figure out why i keep getting this error for illegal start of expression for the private field in java.
public abstract class Dragon -i @param args the command line arguments public static void main (String[] args) i / TODo code application logic here rivate final int breathDamage private String name: //Default constructor public Dragon) t name - "GenericDragon" breathDamage10 //argumented constructor public Dragon (int breathDamage, String name) f this.breathDamage -breathDamage this.name- name //Getters public int getBreathDamage )i return breathDamage public String getName) return name //abstract method abstract boolean isFriendly );Explanation / Answer
public abstract class Dragon {
private int breathDamage;
private String name;
public Dragon() {
name="GenericDragon";
breathDamage=10;
}
public Dragon(int breathDamage, String name) {
this.breathDamage = breathDamage;
this.name = name;
}
public int getBreathDamage() {
return breathDamage;
}
public String getName() {
return name;
}
abstract boolean isFriendly();
public static void main(String[] args) {
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.