t***@gmail.com
2015-09-02 09:32:39 UTC
Hi Team,
I'm new to Java when I write a program for class and objects, when I try to compile the program getting an error message saying "error: <identifier> expected"
Here is the program.
class Card
{
int icount;
Static int tcount;
void swipe()
{
icount++;
tcount++;
}
}
class Demo9
{
public static void main(Static ar[])
{
Card v= new Card();
Card b= new Card();
v.swipe();
b.swipe();
b.swipe();
v.swipe();
v.swipe();
int total= Card.tcount;
int Vikas= v.icount;
int banu= b.icount;
System.out.println("Total students" + total);
System.out.println("Vikas students" + vikas);
System.out.println("Banu students" + banu);
}
}
Truly appreciate your response.
I'm new to Java when I write a program for class and objects, when I try to compile the program getting an error message saying "error: <identifier> expected"
Here is the program.
class Card
{
int icount;
Static int tcount;
void swipe()
{
icount++;
tcount++;
}
}
class Demo9
{
public static void main(Static ar[])
{
Card v= new Card();
Card b= new Card();
v.swipe();
b.swipe();
b.swipe();
v.swipe();
v.swipe();
int total= Card.tcount;
int Vikas= v.icount;
int banu= b.icount;
System.out.println("Total students" + total);
System.out.println("Vikas students" + vikas);
System.out.println("Banu students" + banu);
}
}
Truly appreciate your response.