wood burning stoves 2.0*
The moose likes Java in General and the fly likes Create a user class help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Create a user class help" Watch "Create a user class help" New topic
Author

Create a user class help

Chris Haris
Greenhorn

Joined: Nov 16, 2011
Posts: 22
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
Bartender

Joined: May 31, 2011
Posts: 1776
This code lies out of the main() method. Move it inside the method block.
Chris Haris
Greenhorn

Joined: Nov 16, 2011
Posts: 22
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
Bartender

Joined: May 31, 2011
Posts: 1776
You try to use the variable before its declared.

is different from
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754


Where did you create/declared these attributes?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Claudiu Chelemen
Ranch Hand

Joined: Mar 25, 2011
Posts: 71

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
 
subject: Create a user class help