Random Coding

  • StudentMia 

    Member
    October 20, 2021 at 10:20 am

    package Tutorial1;

    import java.util.Scanner;

    public class Main {

    public static void main(String[] args) {

    String josh = “Josh”;
    Scanner sc = new Scanner(System.in);

    String s = sc.nextLine();

    if (s.equals(josh)) {

    System.out.println(“Hey “+s);

    }

    if (s.equalsIgnoreCase(josh)) {

    System.out.print(“It’s fine, but how are you “+s);
    }

    else if (s.equalsIgnoreCase(“Josh”)) {

    System.out.println(“Hi “+s);

    }

    else if (s.equalsIgnoreCase(s)) {

    System.out.println(“My name is Sandra by the way”);

    }

    else {
    System.out.print(“Hello “+s);

    }

    }

    }

Viewing 1 of 1 replies
Reply to: StudentMia<span class="bp-verified-badge"></span>
Your information:

Cancel
Original Post
0 of 0 posts June 2018
Now