This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

silly error. please help  RSS feed

 
vivek gaur
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


EDIT by mw: Added Code Tags to original poster's indentation.
[ December 30, 2005: Message edited by: marc weber ]
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"ok boy,

We're pleased to have you here with us at JavaRanch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks,
Jeanne
Bartender
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error are you getting with that code? Does it not compile? Does it not run as expected?

Please post the error as it will help people answer your question.

And welcome to JavaRanch!
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general, you need to place code that "does" something inside a method body. Your compilation errors...

...are because you're trying to "do" things outside of a method. If you move this code to the body of a method (like main, for example) then this should compile and run.
 
zhu pan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi boy
In general, you need to place code that "does" something inside a method body

public class number
{
public static void main(String[] args)
{
int a=10;
int b=20;
int c=30;
int big;
big=a;
number n = new number();
System.out.println("Hello World!");
if(b>big)
{
System.out.println("b ");
}
else if(c>big)
{
System.out.println("c ");
}
else
{
System.out.println("a ");
}
}
}

that is ok!
 
vivekkumar sharma
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


EDIT by mw: Added Code Tags to original poster's indentation.

[ December 30, 2005: Message edited by: marc weber ][/qb]<hr></blockquote>

putting braces around statement shown above will also make code compilable
[ January 01, 2006: Message edited by: vivekkumar sharma ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!