java - Why am I getting a Identifier expected error -



java - Why am I getting a Identifier expected error -

import java.util.*; public class students { public static void main(string[] args){ scanner scan=new scanner(system.in); pupil s1=new student();//creates object of class aircraft pupil s2=new student(); //or //student s1,s2 //s1=new student(); //s2=new student(); string str; int i; //str=s1.getname(); } } class student{ //extends students{ string name; int 1; ?<identifier> expected? int 2; ?<identifier> expected? int 3; } }

in lastly 3 lines identifier expected. why? pupil class supposed store name, , 3 test scores.

in java, variables not allowed start numbers - 1 invalid variable name (though num1 valid). see the naming requirements.

to prepare code, rename them int var1, int var2, int var3. (though improve names improve - seek more descriptive)

java identifier

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -