786snow
Programmer
- Nov 12, 2006
- 75
Hi, what am i doing wrong here. I have couple of variable in the constructor but when try
to print them i get errors
I get these erors
to print them i get errors
Code:
public class HelloWorldApp2 {
HelloWorldApp2 (String var1, int var2){
String instanceVariable1 = var1;
int instanceVariable2 =var2;
}
public static void main(String args[]) {
HelloWorldApp2 object6 = new HelloWorldApp2("USA", 2);
object6.letSee();
}
public void letSee()
{
System.out.println("calling class no 4\n");
System.out.println(instanceVariable1 + "\n");
System.out.println(instanceVariable2 + "\n");
}
}
I get these erors
Code:
C:\Program Files\Java\jdk1.5.0_06\bin>javac HelloWorldApp2.java
HelloWorldApp2.java:20: cannot find symbol
symbol : variable instanceVariable1
location: class HelloWorldApp2
System.out.println(instanceVariable1 + "\n");
^
HelloWorldApp2.java:21: cannot find symbol
symbol : variable instanceVariable2
location: class HelloWorldApp2
System.out.println(instanceVariable2 + "\n");
^
2 errors