subject
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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
question
Computers and Technology, 23.06.2019 15:00
To check whether your writing is clear , you can
Answers: 2
question
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
question
Computers and Technology, 25.06.2019 03:30
Kou converged his word document to a powerpoint document. when he received the powerpoint, he was missing material. which most likely explains why the material was missing? a it did not have a proper heading b he incorrectly copied and pasted it c he did not save his document properly d there was not enough space in powerpoint
Answers: 1
You know the right answer?
Simple Java question about command line arguments Edit: figured it out myself, args[0] == "one" sho...
Questions
question
Mathematics, 27.07.2020 08:01
question
Mathematics, 27.07.2020 08:01