View previous topic :: View next topic |
Author |
Message |
PUSHEAX_PUSHEAX Grandmaster Cheater
Reputation: 72
Joined: 13 Apr 2009 Posts: 969
|
Posted: Sat May 08, 2010 9:22 am Post subject: Help with java |
|
|
I can't seem to add an else statement without getting errors, any help?
Code: | import java.util.Scanner;
class math {
public static void main (String args[]){
Scanner greg = new Scanner(System.in);
double tuna;
System.out.print("Please enter a number to be assigned to tuna: ");
tuna = greg.nextDouble();
if (tuna >= 10);{
System.out.println("Tuna is less than or equal to 10!");
}
}
} |
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat May 08, 2010 9:28 am Post subject: |
|
|
Why do you have a semi-colon after your if statement
|
|
Back to top |
|
 |
Steve03416634 Grandmaster Cheater
Reputation: 0
Joined: 12 Dec 2006 Posts: 846
|
Posted: Sat May 08, 2010 9:28 am Post subject: |
|
|
Code: |
if (a == true) {
a = false;
} else if (a == false) {
a = true;
} else {
System.out.print("WHAT ARE YOU DOING.");
}
|
|
|
Back to top |
|
 |
PUSHEAX_PUSHEAX Grandmaster Cheater
Reputation: 72
Joined: 13 Apr 2009 Posts: 969
|
Posted: Sat May 08, 2010 9:31 am Post subject: |
|
|
Slugsnack wrote: | Why do you have a semi-colon after your if statement |
Oh, I'm still learning, thanks.
|
|
Back to top |
|
 |
Stylised Grandmaster Cheater
Reputation: 20
Joined: 04 Nov 2008 Posts: 712
|
Posted: Sat May 08, 2010 9:31 am Post subject: |
|
|
Inb4 delete hall.dll to make it work.
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat May 08, 2010 9:48 am Post subject: |
|
|
Geert Wilders wrote: | Code: |
if (a == true) {
a = false;
} else if (a == false) {
a = true;
} else {
System.out.print("WHAT ARE YOU DOING.");
}
|
|
that's the most disgusting piece of code I've seen in my whole life excluding iPromise and void's handiwork.
|
|
Back to top |
|
 |
Steve03416634 Grandmaster Cheater
Reputation: 0
Joined: 12 Dec 2006 Posts: 846
|
Posted: Sat May 08, 2010 9:57 am Post subject: |
|
|
Slugsnack wrote: | Geert Wilders wrote: | Code: |
if (a == true) {
a = false;
} else if (a == false) {
a = true;
} else {
System.out.print("WHAT ARE YOU DOING.");
}
|
|
that's the most disgusting piece of code I've seen in my whole life excluding iPromise and void's handiwork. |
You're welcome.
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat May 08, 2010 10:05 am Post subject: |
|
|
Although judging from your posts in the past.. maybe you should consider mastering English before you start with other languages.
|
|
Back to top |
|
 |
Steve03416634 Grandmaster Cheater
Reputation: 0
Joined: 12 Dec 2006 Posts: 846
|
Posted: Sat May 08, 2010 10:06 am Post subject: |
|
|
Slugsnack wrote: | Although judging from your posts in the past.. maybe you should consider mastering English before you start with other languages. |
I stand insulted.
|
|
Back to top |
|
 |
PUSHEAX_PUSHEAX Grandmaster Cheater
Reputation: 72
Joined: 13 Apr 2009 Posts: 969
|
Posted: Sat May 08, 2010 10:06 am Post subject: |
|
|
Man Java is easier than C++, I actually get Java unlike C++.
Code: | import java.util.Scanner;
class math {
public static void main(String args[]){
Scanner greg = new Scanner(System.in);
double boy, girl;
System.out.print("Please enter your age(male): ");
boy = greg.nextDouble();
System.out.println("Please enter your age(girl): ");
girl = greg.nextDouble();
if(boy < 18 && girl <18){
System.out.println("you may enter, young buck");
}else{
System.out.println("You may not enter, old cat");
}
}
} |
|
|
Back to top |
|
 |
Womanizer Grandmaster Cheater
Reputation: 2
Joined: 30 May 2009 Posts: 958
|
Posted: Sat May 08, 2010 10:35 am Post subject: |
|
|
Description: |
|
Filesize: |
353.79 KB |
Viewed: |
4920 Time(s) |

|
|
|
Back to top |
|
 |
Cheat Engine User Something epic
Reputation: 60
Joined: 22 Jun 2007 Posts: 2071
|
Posted: Sat May 08, 2010 11:01 am Post subject: |
|
|
Code: | import java.util.Scanner;
class math {
public static void main(String args[]){
Scanner greg = new Scanner(System.in);
double boy, girl;
System.out.print("Please enter your age(male): ");
boy = greg.nextDouble();
System.out.println("Please enter your age(girl): ");
girl = greg.nextDouble();
if(boy < 18 && girl <18) System.out.println("you may enter, young buck");
else System.out.println("You may not enter, old cat");
}
} | I think this edit should work. Also, why the double?
|
|
Back to top |
|
 |
Aniblaze Grandmaster Cheater Supreme
Reputation: 138
Joined: 23 Apr 2006 Posts: 1757 Location: The Netherlands
|
Posted: Sat May 08, 2010 11:27 am Post subject: |
|
|
Holland wrote: | Code: | import java.util.Scanner;
class math {
public static void main(String args[]){
Scanner greg = new Scanner(System.in);
double boy, girl;
System.out.print("Please enter your age(male): ");
boy = greg.nextDouble();
System.out.println("Please enter your age(girl): ");
girl = greg.nextDouble();
if(boy < 18 && girl <18) System.out.println("you may enter, young buck");
else System.out.println("You may not enter, old cat");
}
} | I think this edit should work. Also, why the double? |
Defining the type is a must in Java. You might notice this while we will be programming together as well. I will almost always use:
Code: | (String) $var = ""; |
Because I've learned to do so in Java.
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sat May 08, 2010 12:48 pm Post subject: |
|
|
I think he means why double and not int
|
|
Back to top |
|
 |
CrisNMP Fun Supervisor
Reputation: 16
Joined: 11 Apr 2007 Posts: 4649
|
Posted: Sat May 08, 2010 12:49 pm Post subject: |
|
|
Slugsnack wrote: | Why do you have a semi-colon after your if statement |
Its a winking sad face ;{
_________________
BENBENBENBENBENBENBENBEN |
|
Back to top |
|
 |
|