Question: Hello, I'm working with Java book for dummies and I am trying to piece together a code based on the question below, but it is
Hello,
I'm working with Java book for dummies and I am trying to piece together a code based on the question below, but it is not working at all. I am unsure of how to set it up. the Java programmiz output isn't reflecting the answer. What should I do? Thank you and everyone for your help truly. I'm trying to get Java to correctly accept both username and password for the program to print out Hello World.
import java.util.Scanner; public class main { public static void main(String[] args) { String username = swordfish("Username"); String password = shellfishOPT("Password"); Scanner sc = new Scanner(System.in); System.out.println("Enter Username"); String username = scnr.nextLine(); System.out.println("Enter Password"); String password = scnr.nextLine(); if( (username.equals("swordfish")) && (password.equals("shellfishOPT")); System.out.println("Hello World"); } }
If anyone can help. I appreciate it. I'm trying to make sense of this so I can do it on my own. I really appreciate anyone's help.
Warm regards,
Lily
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
