• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Java Code Help

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys, keep going from error to error with this



This is what its complaining about:
Person.java:5: error: cannot find symbol
public static void main(string[]args);
^
symbol: class string
location: class Person
Person.java:5: error: missing method body, or declare abstract
public static void main(string[]args);
^
Person.java:8: error: incompatible types
name="Petey";
^
required: int
found: String
Person.java:11: error: cannot find symbol
System.out.printin("Your name is "+name +"and you're "
+age);
^
symbol: method printin(String)
location: variable out of type PrintStream
4 errors
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
caveat:you cant call non-static things from static stuff without new stuff.

*i like your combination of old whitesmith and recent famous allman indent though...
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jake Wayne wrote:Hey guys, keep going from error to error with this


1. What is the brace before your println() statement for?
2. What is: 'public static void main(string[]args);'? And before you answer "a main() method declaration", look again, because it isn't (at least not what you think it is).

Winston
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
another hint...

in java, there is a difference between 'a' and 'A', 'b' and B', 'c' and 'C'...all the way up.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) You are declaring name as a int but using it as a string.
2) The braces before the system.out.println are nt required.
3) If you are declaring the variables outside main and using them in main, then you should make the variables as static.
4) string[] args should be String[] args

Hope this will help you compile the code and run the same.

~Vijay k
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic