Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Create a user class help

 
Greenhorn
Posts: 22
  • 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

 
Rancher
Posts: 1776
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You try to use the variable before its declared.

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

Where did you create/declared these attributes?
 
Ranch Hand
Posts: 75
Eclipse IDE Oracle Java
  • 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
 
Space pants. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic