Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

Reply
 
Thread Tools Display Modes
Random Java Code!
Old
LuisN
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2010
Location: Arizona
Default Random Java Code! - 05-05-2010, 09:25 PM

Random Java Code, GO GO GO!

Last edited by x2495iiii; 05-12-2010 at 02:41 PM.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 05-05-2010, 10:15 PM

Haha, um... please fix your title, and what is the point of this thread??


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 05-06-2010, 11:16 PM

Technically, the Lounge is the place for random stuff, and if he wants the title to be that way (which he might), it's his choice.

Did you really just want random Java code then?

Like:

while i > 0, i = 1, i++
{
doSomething();
}

public class doSomething ()
{
System.out.printLn "Cookies!"
}

Did this off the top of my head. Not sure if it's completely error free.


(')>
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 05-07-2010, 03:27 PM

Quote:
Originally Posted by x2495iiii View Post
while i > 0, i = 1, i++
{
doSomething();
}

public class doSomething()
{
System.out.printLn "Cookies!"
}
Haha nice, it looks like that would simply print out the string "Cookies!" infinite times (gaah, infinite loops!!! lol).

There are a few errors in the code, for example it would be a for loop, not a while loop. for(i = 1; i > 0; i++). Also, there would be a syntax error on the print line method. The proper way to do that method would be System.out.println("Cookies!");. there needs to be a lowercase l in println and I believe there has to be parentheses around the parameter.

The problem I had with the title is that it contains an inappropriate slang word, but it might very well be just an honest mistake of the spelling of "code".


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
King Gamer(gorit)
Guest
 
Status:
Posts: n/a
Default 05-07-2010, 03:48 PM

LOL I know what the slang means, but orther than that I think the code that was shown is cool.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 05-07-2010, 06:22 PM

Quote:
Originally Posted by King Gamer(gorit) View Post
LOL I know what the slang means, but orther than that I think the code that was shown is cool.
The code is actually extremely simple. I am taking a java course right now in school and we are making much more complex programs. I agree that it is a random java code though, as the title asks. Here is the easier way to make it loop "Cookies!" infinite times though:

public class Cookies
{
public static void main(String[] args)
{
while(true)
System.out.println("Cookies!");
{
}

Warning though, if you run this application then it will loop the word Cookies! infinite times, and you have to stop it manually or else it will never end and potentially slow down the computer if left running too long.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301

Last edited by Dameria; 05-07-2010 at 06:27 PM.
   
Reply With Quote
^-^
Old
LuisN
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2010
Location: Arizona
Default ^-^ - 05-12-2010, 11:02 AM

Quote:
Originally Posted by x2495iiii View Post
Technically, the Lounge is the place for random stuff, and if he wants the title to be that way (which he might), it's his choice.

Did you really just want random Java code then?

Like:

while i > 0, i = 1, i++
{
doSomething();
}

public class doSomething ()
{
System.out.printLn "Cookies!"
}

Did this off the top of my head. Not sure if it's completely error free.
^-^ Thank you. I really just needed random Java Code, it didn't really matter. Thank you!

Last edited by LuisN; 05-12-2010 at 11:28 AM. Reason: Mispelled word
   
Reply With Quote
Old
LuisN
Member
 
Status: Offline
Posts: 17
Join Date: Apr 2010
Location: Arizona
Default 05-12-2010, 11:03 AM

Quote:
Originally Posted by King Gamer(gorit) View Post
LOL I know what the slang means, but orther than that I think the code that was shown is cool.
=x
   
Reply With Quote
Reply

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

Forum Jump



Copyright ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.