Computers and Technology
Computers and Technology, 20.09.2020 07:01, noseugh

Simple Java question about command line arguments Edit: figured it out myself, args[0] == "one" should be args[0].equals("one")

public Class Test{
public static void main(String[] args) {
System. out. println(args[0]);
if(args[0] == "one")
{ System. out. println("onetest");
}
}
}

it compiles and everything, and when I type
> java Test one
into the command line, this is my output
> one

what am i doing wrong, and why isn't it displaying "onetest" it printed "one" because args[0] is equal to "one," but somehow args[0] isn't "one" because it doesn't print "onetest" ???

expected output is
> one
> onetest

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 17:40, penacesar18p9jrdh
The value of sin(x) (in radians) can be approximated by the alternating infinite series create a function (prob3_2) that takes inputs of a scalar angle measure (in radians) and the number of approximation terms, n, and estimates sin(x). do not use the sin function in your solution. you may use the factorial function. though this can be done without a loop (more efficiently), your program must use (at least) one. you may find the mod() function useful in solving the problem.
Answers: 1
image
Computers and Technology, 24.06.2019 20:20, jdkrisdaimcc11
Write python code that prompts the user to enter his or her age and assigns the user’s input to an integer variable named age.
Answers: 1
image
Computers and Technology, 24.06.2019 22:00, sierrawalk2283
True or false technology is often discovered by accident
Answers: 2
image
Computers and Technology, 25.06.2019 00:00, Ryan02717
Into which of these files would you paste copied information to create an integrated document? a. mailing list b. destination c. source d. data source
Answers: 1
Do you know the correct answer?
Simple Java question about command line arguments Edit: figured it out myself, args[0] == "one" sho...

Questions in other subjects: