Hi, can anybody help me with this? I am doing an Introduction to Programming module using Java and am stuck at this question. Write a program which reads in a username and a password, and expects the username to be "brian" and the password to be "spam". The program should print a welcome message if these are both correct. Thanks.
There are quite a few syntax errors there - missing () etc. Compile your program to get a list of syntax errors and fix them (start at the top and re-compile after each one, as an error early in the code can disrupt parsing of the code that follows).
Then a couple of hints:
To compare Strings you can't use == (even less =, which is assignment). YOU need the equals method (documented in the standard API doc for String)
You can use a Scanner with System.in to read input from the user. Google for more detail.