SilabGarza - RS Private Server  
Home Forum Play Register Store Market Highscores Mark Forums Read
Go Back   SilabGarza - RS Private Server > SilGar Media > Computers > Programming
Reload this Page What is wrong with the code? - Java


What is wrong with the code? - Java
Old
  (#1 (permalink))
Ries is Offline
Senior Member
image
 
Ries's Avatar
 
Posts: 4,198
Cookies Given: 0
Cookies Received: 22
Time Online: 24 d 18 h 11 m
Clan: W.I.N Co-owner
   
Default What is wrong with the code? - Java - 09-02-2012, 04:40 PM

I'm new to this. I'm not sure where everything has to go in terms of If/then statements and such. When compiling, I get an error saying "; expected" at:

Code:
If (FirstStatus == 0){
But when I put the ";" in, it gives me yet another error saying "'else' without 'if' at:

Code:
else if{
Code:
public class Tester {
public static void main(String[] args) 
{

Scanner Keyboard = new Scanner(System.in); //Creates the first scanner and enables multiple methods.

System.out.print("Enter an integer: _");
String FirstInteger = Keyboard.nextLine();
System.out.print("Enter an integer: _");
String SecondInteger = Keyboard.nextLine();
System.out.print("Enter an integer: _");
String ThirdInteger = Keyboard.nextLine();

FirstStatus = (FirstInteger%2);
SecondStatus = (SecondInteger%2);
ThirdStatus = (ThirdInteger%2);

If (FirstStatus == 0){
    System.out.println("The integer" + FirstInteger + "is even.");

else if{
    System.out.println("The integer" + FirstInteger + "is odd.");  
}
}

If (SecondStatus == 0){
    System.out.println("The integer" + SecondInteger + "is even.");

else if{
    System.out.println("The integer" + SecondInteger + "is odd.");  
}
}

If (ThirdStatus == 0){
    System.out.println("The integer" + ThirdInteger + "is even.");

else if{
    System.out.println("The integer" + ThirdInteger + "is odd.");  
}
}
}
}





Spoiler


[Josh] [Roman] [Steven] [Steele] [Wyatt] [Jaden] [Becky] [Brendan]
  
Old
  (#2 (permalink))
Ries is Offline
Senior Member
image
 
Ries's Avatar
 
Posts: 4,198
Cookies Given: 0
Cookies Received: 22
Time Online: 24 d 18 h 11 m
Clan: W.I.N Co-owner
   
Default 09-02-2012, 07:23 PM

Nevermind. I fixed it. Lol.





Spoiler


[Josh] [Roman] [Steven] [Steele] [Wyatt] [Jaden] [Becky] [Brendan]
  
adsense code2.3
Closed Thread

Bookmarks

What is wrong with the code? - Java

Programming




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
adsense2.6
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 12:01 AM.





Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.