Question about main(String[] args) [migrated]
- by Andrew0085
I'm new to programming, and I'm using java. Here's a program I wrote:
class HelloApp {
static String hi;
public static void main(String[] args) {
int length = args.length;
if (length > 0) {
hi = args[0];
sayHi();
}
}
static void sayHi() {
if (hi == "hello") {
System.out.println("Hello!");
}
}
}
My question is: Why doesn't inputting "java HelloApp hello" make "Hello!" appear on the next line?