Jump to content

  • Log In with Google      Sign In   
  • Create Account

Adderly

Member Since 17 Dec 2010
Offline Last Active May 10 2012 08:55 AM

Topics I've Started

Console Error in Eclipse

08 May 2012 - 11:46 AM

Anyone know why I might be getting this in the Eclipse console when I try to run something? It looks like Eclipse's run configuration might be a little wonky, but I've only been playing with Java and Eclipse for about a month, so I haven't the slightest clue where to begin.

Usage: javaw [-options] class [args...]
(to execute a class)
or javaw [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
-hotspot is a synonym for the "server" VM [deprecated]
The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.co...tion/index.html for more details.


Any suggestions would be greatly appreciated Posted Image Thanks in advance.

If/Else Statements in Swtich Statements?

19 May 2011 - 06:21 PM

So basically, I'm trying to write a pretty basic Rock, Paper, Scissors console game. Here's what I have so far:




public class RockPaperScissors {
	public static void main(String[] args) {
		String win = "You win!";
		String lose = "Sorry. You lose.";
		String computerMove;
		String selection;
		int myMove;
		int rand;
		
		
		//Get myMove
		
		TextIO.putln("What's your move?");
		TextIO.putln();
		TextIO.putln("	1. Rock");
		TextIO.putln("	2. Paper");
		TextIO.putln("	3. Scissors");
		myMove = TextIO.getlnInt();
		
		//Get computerMove
		
		rand = (int)(3*Math.random());
		if ( rand == 0)
			computerMove = "Rock";
		else if (rand == 1)
			computerMove = "Paper";
		else
			computerMove = "Scissors";
		
		//Compare moves
		
		switch (myMove) {
		case 1:
			selection = "Rock";
				if (computerMove == "Paper")
					TextIO.putln(lose);
					TextIO.putln(computerMove);
					TextIO.putln(" beats ");
					TextIO.putln(selection);
				else
					TextIO.putln(win);
					TextIO.putln(selection);
					TextIO.putln(" beats ");
					TextIO.putln(computerMove);
				}
					
		}
	}

The compiler is saying the "ELSE" statement in the case labeled "Case 1" is giving me the error: "Syntax error on token "else", delete this token". What can I do to remedy this? Thanks in advance.

PS. I posted a topic earlier, but it's subject has nothing to do with the content of this one. If I've created too many topics, please feel free to let me know so I can move this into the prior topic. Thanks again.

Learning Multiple Languages

19 May 2011 - 12:05 PM

I've just begun to really dive into the programming world, and I've skimmed across both C++ and Java in an effort to decide what language best suits my learning habits. It's my understanding that once I learn one language, some others will be easier to pick up. My question is, would any of you consider it futile or even counter productive to learn to learn two languages at once? I've been reading Bruce Eckel's "Thinking in C++ 2nd Edition" and David J. Eck's "Java Notes Version 5" (Java Notes) and ever so often, I'll take a code sample from one of the two and try to write it in both languages. Is this generally a good idea or should I focus all of my attention toward one or the other? For the most part (and for now, as I'm still working within the confinements of console applications in C++ and haven't really gotten into the use of libraries yet) I'm pretty sufficient in pulling code from the Java book and duplicating it in C++ and vise versa, but I'm wondering if I'll come to a point when I get into libraries where this will come to a halt. Any input on the situation would be greatly appreciated. Thanks in advance.




Adderly


What Am I Doing Wrong Here?

07 May 2011 - 02:04 PM

int[] arrayThree = new int[20];
        
        int total = 3;
        for (int i = 0; i < 20; i++)
        total = total*arrayThree[i];
  TextIO.putln(total);

Please don't mind the fact that I haven't commented any of the code, but it's a very small program that I'm sure should be much simpler than I'm making it out to be. Basically, what I'm trying to do is create an array of multiples of three so I can add everything within the array after everything is said and done. I'm a straight up newbie here and have been reading as much as I can, but I learn most by applying concepts I read.

I imagine most of you are familiar with Project Euler and for those who are, I'm trying to find the solution to Problem 1. I DO NOT WANT THE ANSWER. Just point me in the right direction, if you could. =) Thanks, in advance.


The Only Errors I Don't Mind Hearing

04 May 2011 - 10:17 PM

Windows XP/98 Music

PARTNERS