Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create a user class help

 
Chris Haris
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So far I've made this class, but when I try to test it with the second code, i get the attached error.. Can anybody help me fix it?





10 errors found:
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable userid
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable pass1
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable pass2
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable email
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable name
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable address
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable city
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable state
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable zip
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 53]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:53: cannot find symbol
symbol : variable phone
location: class NewUserDemo
 
John Jai
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This code lies out of the main() method. Move it inside the method block.
 
Chris Haris
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did that and made it this: but now I get more errors... What am I doing wrong?



10 errors found:
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable userid
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable pass1
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable pass2
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable email
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable name
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable address
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable city
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable state
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable zip
location: class NewUserDemo
File: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java [line: 10]
Error: C:\Users\Chris\Desktop\Java Programming Programs\java\NewUserDemo.java:10: cannot find symbol
symbol : variable phone
location: class NewUserDemo
 
John Jai
Rancher
Posts: 1776
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You try to use the variable before its declared.

is different from
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Where did you create/declared these attributes?
 
Claudiu Chelemen
Ranch Hand
Posts: 75
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should create the user1 object after you've got all the data from the scanners.
Also note that you're creating a lot of Scanner objects you're not using.

Cheers,
Claudiu
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic