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, 22.06.2019 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
question
Computers and Technology, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Which task uses a simple parameter?
Answers: 1
question
Computers and Technology, 24.06.2019 00:20
Describe a data structures that supports the stack push and pop operations and a third operation findmin, which returns the smallest element in the data structure, all in o(1) worst-case time.
Answers: 2
You know the right answer?
Simple Java question about command line arguments Edit: figured it out myself, args[0] == "one" sho...
Questions
question
Geography, 05.10.2019 05:40
question
Spanish, 05.10.2019 05:40
question
Chemistry, 05.10.2019 05:40
question
Mathematics, 05.10.2019 05:40
Questions on the website: 13722363