Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

Does it have correct contact information?

Answered: 1 week ago

Question

Do you currently have a team agreement?

Answered: 1 week ago

Question

How will the members be held accountable?

Answered: 1 week ago