Witam domyslam sie ze dla was moje pytanie jest banalne ale jestem naprawde począdkujący. Prosze mi powiedzieć w poniższym kodzie trzeba miec zdeklarowane tablice args[0] oraz args[1] żeby obydwie mialy przypisane jakieś wartości jak to zrobić??
//: operators/E04_Velocity.java
// {Args: 30.5 3.2}
/****************** Exercise 4 *****************
* Write a program that calculates velocity
* using a constant distance and a constant time.
***********************************************/
package operators;
public class E04_Velocity {
public static void main(String[] args) {
if(args.length < 2) {
System.err.println(
"Usage: java E04_Velocity distance time");
System.exit(1);
}
float distance = Float.parseFloat(args[0]);
float time = Float.parseFloat(args[1]);
System.out.print("Velocity = ");
System.out.print(distance / time);
// Change the next line if you want to use a different
// unit for 'distance'
System.out.println(" m/s");
}
} /* Output:
Velocity = 9.53125 m/s
*///:~