Jesse and Freya- java lesson 1: Java hello world
Uploader Comments (ErebusWolf)
All Comments (20)
-
Zelda triangle in the back :)
-
First off, sorry for replying to the wrong video. Don't know why that happened. Also, thanks for the advice, i was wondering why I wasn't getting the correct square root, just add one, so simple. Ill give it another shot. Thanks Jesse.
-
sorry it looks like that, i was only allowed 500 chars
-
if you would rather not do it that way. I suggest deleting that line from the file. The System.... line and then try javac again after saving. See what happens they try putting it back in manually.
-
ok well, I wanted to keep this on the youtube message board so other people could benefit but I think we are beyond that. Send me a private message with an AIM MSN Skype or gtalk account you want to talk with me on.
-
it says javac 1.6.0_07
-
it says javac 1.6.0_07
-
in a command prompt type "javac -version"
Then at the top of the output text find the version number. Comment that version number here. Also, try retyping the HelloWorld program. It might be an issue of mac formatting vs windows formatting.
Hay Jesse, does this look right to you?
{public static void main(String[] args) {PrimeNumber(321);} public static double PrimeNumber(double number) {double sqr = (double) Math.sqrt ( number ); System.out.println("Root = " + sqr); for (double i=2; i<sqr; i++) {double n = sqr%i; System.out.println(n); if (n==0) { System.out.println("This is not a prime number"); } if (n!=0) {System.out.println("This is a prime number");} } return sqr; }}
scolariIRE 3 years ago
no problem about formatting . I am just glad that you didn't intentionally do it that way. Short answer is no. Your program does not work. There is no whole number that it finds to be not prime. enter 25 as a number and see if it's prime. First EVERY number should be an int. there is no reason for them to be doubles. the square root value should be rounded up (add one to it) . and your for loop should be <= . also you should return a boolean (true/false) not return the same value put in. Thanks!
ErebusWolf 3 years ago