• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Help a beginner with Java

Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
<Original question answered>

Edit: I'll post more questions as I'm learning.
 
Last edited by a moderator:

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
If you already have it working for classes why doesn't it work for javac? Maybe you just need to use something like "javac .\myfile.java"?

All you should need to do is add the Java directory to the "path" system variable.
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,436 (2.43/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
set the path for it i believe.
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
How do you set the path for it? I've been reading around and am completely confused.
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
Another question.

In the following code:
public class Addition {
public Addition( ) {
int x, y = 1, z = 2;

x = y + z;
System.out.println("+ operator resulted in "+x);
}

public static void main(String args[]){
new Addition();
}
}

is

public Addition( ) {
the method header

int x, y = 1, z = 2;

x = y + z;
System.out.println("+ operator resulted in "+x);
}
the method body and
new Addition();
the method call?
 

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
How do you set the path for it? I've been reading around and am completely confused.
Easiest way to do it is in System Properties (in Windows 7 you can use Start->Run->systempropertiesadvanced.exe).


Then select Environment Variables and you'll see this window.


Then click "Path" in the lower box and hit "Edit" and you'll get here:


Then just add a semicolon and the path to your Java directory (with javac).
Another question.
I'm pretty sure that's correct, though my terminology is a bit rusty.
 
Last edited:
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
I ignored path and thought I had to add SOURCEPATH :banghead:

Edit: I've already done that what I meant was how do I set it (cmd) to know where my .java files are, not javac.
 
Last edited:

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
Edit: I've already done that what I meant was how do I set it (cmd) to now where my where my .java files are, not javac.
Well it doesn't really work that way as far as I know, but it does work the other way.

You have to type in the directory of your .java files at one time or another. The idea is usually to cd into the directory with your .java files and then all you need to do is type "javac myfile.java". You could also make a batch file which would simplify the process even further.
 

Easy Rhino

Linux Advocate
Staff member
Joined
Nov 13, 2006
Messages
15,436 (2.43/day)
Location
Mid-Atlantic
System Name Desktop
Processor i5 13600KF
Motherboard AsRock B760M Steel Legend Wifi
Cooling Noctua NH-U9S
Memory 4x 16 Gb Gskill S5 DDR5 @6000
Video Card(s) Gigabyte Gaming OC 6750 XT 12GB
Storage WD_BLACK 4TB SN850x
Display(s) Gigabye M32U
Case Corsair Carbide 400C
Audio Device(s) On Board
Power Supply EVGA Supernova 650 P2
Mouse MX Master 3s
Keyboard Logitech G915 Wireless Clicky
Software The Matrix
first off, not to be a dick, but you gotta correct your grammar. i had to read your question 3 times before i figured out what you were asking. better grammar means more people willing to help.

a .java file is the source code. you run javac on the .java file to compile it into a class file which you then execute running the java <your java class file>.

so you have to either be in the directory of your compiled java program or include the entire working directory.
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
I just changed the default start directory for a shortcut of cmd. That solves that problem.

first off, not to be a dick, but you gotta correct your grammar. i had to read your question 3 times before i figured out what you were asking. better grammar means more people willing to help.

I couldn't think of a better way to word it (otherwise I would've just googled it...)
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
I popped my programing cherry.
import java.util.Scanner;

public class test {

public static void main(String args[]) {

Scanner input = new Scanner(System.in);

int a;
int b;
int c;

System.out.print("a = ");
a = input.nextInt();

System.out.print("b = ");
b = input.nextInt();

c = a + b;
System.out.print(c);
}
}

I'm going to practice with maths for now then do that archery thing Kreij mentioned in another thread.

PS. Is it bad to have to regularly look up syntax?
 
Joined
Nov 18, 2006
Messages
2,964 (0.47/day)
Location
your local vending machine
System Name HTPC||Lenovo IBM ThinkPad
Processor AMD Phenom II x4 965 stock 3.4GHz||Intel C2D T9300 @ 2.5GHz
Motherboard Zotac 890GX-ITX WiFi||Lenovo 8918CTO
Cooling Stock 3x 120's||Stock stuff
Memory 8GB (2x4GB) DDR3 6-6-6-15||3GB DDR2
Video Card(s) Asus 3870x2||nVidia Quadro NVS 140M
Storage 1TB Seagate Barracuda, 1x 2TB WD EARX ||Hitachi 160GB 7200RPM
Display(s) Samsung T260HD||
Case SilverStone Grandia GD05||
Audio Device(s) on-board||on-board
Power Supply Cooler Master 450W||6-cell
Software Windows 7 Pro x64||Windows 7 Pro x64/Linux Mint x64
PS. Is it bad to have to regularly look up syntax?

Not at all for a beginner! :)
I still have to look up syntax for some things. The more you do it, the easier it will become and the less you will have to reference
 

Kreij

Senior Monkey Moderator
Joined
Feb 6, 2007
Messages
13,817 (2.21/day)
Location
Cheeseland (Wisconsin, USA)
No raz, with 1000s of APIs and a jillion methods that are available in some of the modern programming languages, and the fact that with language revisions they will add/obsolete calls, you will be using references constantly.
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
I was looking for java keyword definitions and found them on Wikipedia. The definition of "void" has me confused.
Wikipedia defines void as, "The void keyword is used to declare that a method does not return any value.", if that's true how did the code I posted earlier return a value?:wtf:

EDIT: Also, can any of you folks remember how long it took you to start using correct case letters (upper/lowercase) in code? That seems to be the commonest error I make.
 
Last edited:
Joined
Aug 10, 2007
Messages
4,267 (0.70/day)
Location
Sanford, FL, USA
Processor Intel i5-6600
Motherboard ASRock H170M-ITX
Cooling Cooler Master Geminii S524
Memory G.Skill DDR4-2133 16GB (8GB x 2)
Video Card(s) Gigabyte R9-380X 4GB
Storage Samsung 950 EVO 250GB (mSATA)
Display(s) LG 29UM69G-B 2560x1080 IPS
Case Lian Li PC-Q25
Audio Device(s) Realtek ALC892
Power Supply Seasonic SS-460FL2
Mouse Logitech G700s
Keyboard Logitech G110
Software Windows 10 Pro
That's because it didn't return anything, unlike this (poor) example:

Code:
public int getTheNumberTen() {
	return 10;
}
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
Then would I be correct in assuming returning a value means "returning a value to the code"?



Another question:
The following code makes cmd say "Your target is x" where x is a value.
System.out.println("Your target is " +x_target)

However I want cmd to say "Your target is x meters away" where x is a value. The code I'm using to make this happen is,
System.out.println("Your target is " +x_target " meters away")
, which doesn't work/compile. What do I have to do to make it work/compile?
 
Last edited:
Joined
Aug 10, 2007
Messages
4,267 (0.70/day)
Location
Sanford, FL, USA
Processor Intel i5-6600
Motherboard ASRock H170M-ITX
Cooling Cooler Master Geminii S524
Memory G.Skill DDR4-2133 16GB (8GB x 2)
Video Card(s) Gigabyte R9-380X 4GB
Storage Samsung 950 EVO 250GB (mSATA)
Display(s) LG 29UM69G-B 2560x1080 IPS
Case Lian Li PC-Q25
Audio Device(s) Realtek ALC892
Power Supply Seasonic SS-460FL2
Mouse Logitech G700s
Keyboard Logitech G110
Software Windows 10 Pro
Seems like you're missing a "+" after the x_target variable. You need it to concatenate " meters away" with the beginning portion.


That's one way to describe it. It's going to return the result so you may do with it as you will.

Ex: Lets say you have a function that returns a value describing how close a user got to the the target based on the angle, meters away, and the bow pull. It's something that you want to print out, but also save in an array so that the user can see their last ten moves or something like that.

Code:
proximity = getProximity(angle, meters, power)

Now you can print out the variable proximity and store it.

Note: Much more familiar with PHP, sorry if my Java syntax is off.
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
Is it better to have several small formulae,
u = Math.sqrt((2 * P * t_bow) / m);

t = (u * Math.sin(Math.toRadians(theta))) / 4.9;

x = Math.round(t * u * Math.cos(Math.toRadians(theta)) * 100)/100.0d;


or one big formula,
x = Math.round(((Math.sqrt((2 * P * t_bow) / m) * Math.sin(Math.toRadians(theta))) / 4.9) * u * Math.cos(Math.toRadians(theta)) * 100)/100.0d;
?
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
So far I have this for the archery game,
import java.util.Scanner;

public class archery{
public static void main(String args[]){
Scanner input = new Scanner(System.in);

double x_target;
double P;
double theta;
double u;
double t;
double x;
double s_target;
double d_target;
double m = 1.0;
double t_bow = 1.0;

System.out.println("Let's shot some arrows!");

x_target = 1 + (Math.round(100 * Math.random() * 100)/100.0d);
System.out.println("Your target is " +x_target+ " meters away");
System.out.println();

System.out.println("How much power will you pull the bow with: ");
P = input.nextDouble();
System.out.println();

System.out.println("At what angle will you shoot your arrow: ");
theta = input.nextDouble();
System.out.println();

u = Math.sqrt((2 * P * t_bow) / m);

t = (u * Math.sin(Math.toRadians(theta))) / 4.9;

x = Math.round(t * u * Math.cos(Math.toRadians(theta)) * 100)/100.0d;

s_target = x_target - x;

if (s_target < 0){
d_target = s_target * -1;
}
else{
d_target = s_target;
}

if (d_target > 1){
System.out.println("You were "+Math.round(d_target * 100) / 100.0d+" meters off");
}
else {
System.out.println("Well done you hit the target");
}
}
}

How do I make it return to the bit just after it's worked out "x_target" if "d_target" > 1?
Other than that it works, yay.

EDIT: I can advertise this game as using real Newtonian physics, lol.
 
Last edited:

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
Is this what you want?
Code:
 . . .

[B]double d_target=2;[/B]

 . . . 

x_target = 1 + (Math.round(100 * Math.random() * 100)/100.0d);
[B]while (d_target > 1) {[/B]
     System.out.println("Your target is " +x_target+ " meters away");
     System.out.println();

     System.out.println("How much power will you pull the bow with: ");
     P = input.nextDouble();
     System.out.println();

     System.out.println("At what angle will you shoot your arrow: ");
     theta = input.nextDouble();
     System.out.println();
     
     u = Math.sqrt((2 * P * t_bow) / m);

     t = (u * Math.sin(Math.toRadians(theta))) / 4.9;

     x = Math.round(t * u * Math.cos(Math.toRadians(theta)) * 100)/100.0d;

     s_target = x_target - x;

     if (s_target < 0){
          d_target = s_target * -1;
     }
     else{
          d_target = s_target;
     }

     if (d_target > 1){
          System.out.println("You were "+Math.round(d_target * 100) / 100.0d+" meters off");
     }
[B]}[/B]
System.out.println("Well done you hit the target");
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
Is this what you want?
Code:
 . . .

[B]double d_target=2;[/B]

 . . . 

x_target = 1 + (Math.round(100 * Math.random() * 100)/100.0d);
[B]while (d_target > 1) {[/B]
     System.out.println("Your target is " +x_target+ " meters away");
     System.out.println();

     System.out.println("How much power will you pull the bow with: ");
     P = input.nextDouble();
     System.out.println();

     System.out.println("At what angle will you shoot your arrow: ");
     theta = input.nextDouble();
     System.out.println();
     
     u = Math.sqrt((2 * P * t_bow) / m);

     t = (u * Math.sin(Math.toRadians(theta))) / 4.9;

     x = Math.round(t * u * Math.cos(Math.toRadians(theta)) * 100)/100.0d;

     s_target = x_target - x;

     if (s_target < 0){
          d_target = s_target * -1;
     }
     else{
          d_target = s_target;
     }

     if (d_target > 1){
          System.out.println("You were "+Math.round(d_target * 100) / 100.0d+" meters off");
     }
[B]}[/B]
System.out.println("Well done you hit the target");

Couldn't get what you wrote to work. However that helped me learn the do-while thing, so thank you.:toast:

Here's my awesome game:
import java.util.Scanner;

public class archery{
public static void main(String args[]){
Scanner input = new Scanner(System.in);

double x_target;
double P;
double theta;
double u;
double t;
double x;
double s_target;
double d_target;
double m = 1.0;
double t_bow = 1.0;

System.out.println("Let's shot some arrows!");

x_target = 1 + (Math.round(100 * Math.random() * 100)/100.0d);
System.out.println("Your target is " +x_target+ " meters away");
System.out.println();

do {
System.out.println("How much power will you pull the bow with: ");
P = input.nextDouble();
System.out.println();

System.out.println("At what angle will you shoot your arrow: ");
theta = input.nextDouble();
System.out.println();

u = Math.sqrt((2 * P * t_bow) / m);

t = (u * Math.sin(Math.toRadians(theta))) / 4.9;

x = Math.round(t * u * Math.cos(Math.toRadians(theta)) * 100)/100.0d;

s_target = x_target - x;

if (s_target < 0){
d_target = s_target * -1;
}
else{
d_target = s_target;
}
if (d_target > 1){
System.out.println("You were "+Math.round(d_target * 100) / 100.0d+" meters off");
System.out.println();
}
else {
System.out.println("Well done you hit the target");
}
}
while (d_target > 1);


}
}
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
What would be a logical step up from the archery game? Preferably something that doesn't require much imagination (so no text adventure).
 
Joined
Aug 17, 2009
Messages
1,585 (0.30/day)
Location
Los Angeles/Orange County CA
System Name Vulcan
Processor i6 6600K
Motherboard GIGABYTE Z170X UD3
Cooling Thermaltake Frio Silent 14
Memory 16GB Corsair Vengeance LPX 16GB (2 x 8GB)
Video Card(s) ASUS Strix GTX 970
Storage Mushkin Enhanced Reactor 1TB SSD
Display(s) QNIX 27 Inch 1440p
Case Fractal Design Define S
Audio Device(s) On Board
Power Supply Cooler Master V750
Software Win 10 64-bit
My advice is to learn Perl or Python or even C.

I hate Java. It's buggy as hell.
 

streetfighter 2

New Member
Joined
Jul 26, 2010
Messages
1,655 (0.33/day)
Location
Philly
What would be a logical step up from the archery game? Preferably something that doesn't require much imagination (so no text adventure).
Seeing as how 99% of the world does not use console applications, I'd suggest making a GUI for your archery game. The structure of GUI code is fairly similar in most languages, meaning they're mostly event driven. Here's the (rather poorly written IMO) official tutorial.

I'd create a simple window with a couple edit controls (text boxes) for inputting theta/P and a button to start the simulation. Then I'd plot the arrows path and show the origin and target.

It sounds complicated but it's actually very easy.
 
Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
What am I doing wrong with this piece of code?
import java.util.*;

public class vectortest {

public static void main(String args[]){
Vector v = new Vector(5, 5);

while (int i = 0; i < 25; i++){
v.add(i, i);
}

int k = (int)v.get(4);
System.out.println(k);
}
}
I'm trying to make a 25 places big vector with each place containing an integer with the same value as the place itself (hence the (i, i)). Then it should display the 5th int in the vector.
The errors:
 
Top