Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!

John Simer

Greenhorn
+ Follow
since Dec 19, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Simer

Thank you guys, God Bless you Guys. He surely has personal plans for you guys
7 years ago
But I do have another question.

should i code this as


or


both work fine, which is the better coding practice.
player2 is private in the shooter class, but the Player class is public.
7 years ago
So in my shooter (main) class

in my gameObject class


in my Player class which extends GameObject


and finally here's the problem in my shooter class under public void keyReleased(KeyEvent e) {

In my game, when you press ENTER, it sets player2's AND player1's ammo minus 1 of what player2's ammo was before
and when you press SPACE, it does not do anything.

Why is it recognizing only player2's methods and objects and not player 1's?

Thank you,
God Bless you

----EDIT------
Nevermind i solved the problem, when i was displaying the ammo on my game screen, i made a typo and put player2 for both
7 years ago
Thank you Thomas, but in this sample code the guy didn't import the class and still used the short name for Account?
7 years ago
yes I do know about packages.
At the top of the code on both of them, wouldn't you have to put

package nameOfThePackageTheseAreBothIn;

Or do you just never have to say what package it is in?

Thanks
God Bless you, the Lord Jesus has great plans for you
7 years ago
So, i was reading a tutorial. The guy made an Account class.


And hopefully i understand this. In the next class he made an Account object named my_account by calling the constructor Account() and then changed the double amount by calling some methods -"my_account.method().



But here's my question. He made the Account class and he made the AccountDemo main class. How does the AccountDemo know the Account class information without ever importing the Account class? Does it automatically know if its in the same folder or directory, or are you supposed to import it?

Thanks and God Bless you helping people.

Matthew 1:23 - "Behold, the virgin shall be with child, and bear a Son, and they shall call His name Immanuel," which is translated, "God with us."
Merry Christmas (or Happy Holidays) and God Bless you all.
7 years ago

Orton K Randy wrote:I was asked the same question in my interview months ago. I am surprised no one in here mentioned the log/exponentiation? After trying out for several no. of balls, you'd have noticed a pattern. Ya don't even think twice. Min no. of weighings(in a physical balance of course) required is

log n to the base 2

where 'n' is the no. of balls.

So if the no. of balls is 4, you need 2 weighings, for 8 you need 3, for 16 you need 4 and so on. Note that for 12 you need 3 and NOT 4. Likewise for 5,6,7 you need only 2 and NOT 3. So in programming terms, it's floor(log n to the base 2).

You might well be aware of this, still this one's for those trying to work out everytime.




I do believe you can solve 8 balls in two weighings

Leave any two out(7 and 8)
Weigh (1,2,3) with (4,5,6)
1. if one side is heavier than the other i.e.(1,2,3), weigh two of them (2 and 3)
- if 2 ==3, then 1 is the heavier
- if 2 != 3, then the heavier one is heavier
2. if (1,2,3)==(4,5,6), weigh 7 and 8.

Wait this only works if you know the odd one is either heavier or lighter - not if it could be either, so nevermind...
----------------
Matthew 1:23 - “Behold, the virgin shall be with child, and bear a Son, and they shall call His name Immanuel,” which is translated, “God with us.”
Merry Christmas (or Happy Holidays) and God Bless you all.
In programming just avoid spaces period, i guess. Do "source_files" instead
7 years ago
Help, I can compile(javac) my program, but not run(java) it.

"C:\Program Files\Java\jdk1.6.0_30\bin>javac C:\jvj\HelloWorldApp\HelloWorldApp.java
C:\Program Files\Java\jdk1.6.0_30\bin>cd\jvj\HelloWorldApp
C:\jvj\HelloWorldApp>dir
Volume in drive C is ACER
Volume Serial Number is A057-D808
Directory of C:\jvj\HelloWorldApp
12/20/2011 08:48 PM <DIR> .
12/20/2011 08:48 PM <DIR> ..
12/20/2011 09:00 PM 432 HelloWorldApp.class
12/20/2011 01:43 PM 118 HelloWorldApp.java
2 File(s) 550 bytes
2 Dir(s) 75,082,752,000 bytes free"

but running it doesnt work.

"C:\jvj\HelloWorldApp>java HelloWorldApp
'java' is not recognized as an internal or external command,
operable program or batch file."

likewise,

"C:\jvj\HelloWorldApp>java -cp . HelloWorldApp
'java' is not recognized as an internal or external command,
operable program or batch file."

and,

"C:\jvj\HelloWorldApp>java -classpath . HelloWorldApp
'java' is not recognized as an internal or external command,
operable program or batch file."

What do I do?
------EDIT----
Well the whole time my path variable wasnt working. Turned out i needed to restart the cmd



yipee!

Thank you for all the help,
God Bless you with true peace
7 years ago
Ok basically I reinstalled java again this time version 6u29 instead of 7u2, and i got the javac to work
"C:\Program Files\Java\jdk1.6.0_30\bin>javac C:\jvj\HelloWorldApp\HelloWorldApp.j
ava

C:\Program Files\Java\jdk1.6.0_30\bin>cd\jvj\HelloWorldApp

C:\jvj\HelloWorldApp>dir
Volume in drive C is ACER
Volume Serial Number is A057-D808

Directory of C:\jvj\HelloWorldApp

12/20/2011 08:48 PM <DIR> .
12/20/2011 08:48 PM <DIR> ..
12/20/2011 09:00 PM 432 HelloWorldApp.class
12/20/2011 01:43 PM 118 HelloWorldApp.java
2 File(s) 550 bytes
2 Dir(s) 75,082,752,000 bytes free"
but running it still doesnt work.
"C:\jvj\HelloWorldApp>java HelloWorldApp
'java' is not recognized as an internal or external command,
operable program or batch file."

likewise,
"C:\jvj\HelloWorldApp>java -cp . HelloWorldApp
'java' is not recognized as an internal or external command,
operable program or batch file."
and,
"C:\jvj\HelloWorldApp>java -classpath . HelloWorldApp
'java' is not recognized as an internal or external command,
operable program or batch file."



EDIT: --------------
i made a new topic that now there is a different problem
Thanks for all the help guys!
Jesus Christ is truly amazing!
7 years ago
I'm not really sure... Because i'm using the "java" and not the "javac", so isnt the "java" just running it?

But regardless how do I make it work? (i.e. when i use the java.exe it runs the program)
7 years ago
i hit this problem and you just have to save it with quotes

i.e.

instead of saving it as

HelloWorldApp.java
>which makes it "HelloWorldApp.java.txt"

save it as

"HelloWorldApp.java"
>which saves it as "HelloWorldApp.java"

Also make sure that when you click Save As, you choose "All Files" and not just ".txt" or ".rtf"

----------------------------EDIT--------------------------------------------
my bad, John Jai already helped you.
7 years ago
Ok I just decided to delete java off my flashdrive(H:) and save it on my computer (C:), and I got the compiling part to work, but in a weird way. I had to go to where the javac.exe and from there type the javac command for the entire file name like this:

"C:\Program Files\Java\jdk1.7.0_02\bin>javac C:\jvj\HelloWorldApp\HelloWorldApp.j ava"

then the .class showed up in my directory

Directory of C:\jvj\HelloWorldApp

12/20/2011 01:43 PM <DIR> .
12/20/2011 01:43 PM <DIR> ..
12/20/2011 01:43 PM 432 HelloWorldApp.class
12/20/2011 01:43 PM 118 HelloWorldApp.java
2 File(s) 550 bytes
2 Dir(s) 74,377,527,296 bytes free


but when i tried running it...

C:\jvj\HelloWorldApp>java HelloWorldApp.class
Error: loading: H:\Java\bin\client\jvm.dll

^why is it still trying to get stuff from my flashdrive? It should be trying to get the files from C:\Program Files\Java\jre6\bin
7 years ago
My bin folder is saved inside of my Java folder
7 years ago
I believe I installed it to the H: drive and never copied anything
7 years ago