This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Code Help

 
Jake Wayne
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • 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...
 
Winston Gutkowski
Bartender
Pie
Posts: 9484
50
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12021
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Vijay Kalkundri
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic