Alright i need some help, been stuck on a basic task.
I input 2 strings. I need to be able to have it compare the two strings to see which one is shorter, then count how short the item is and out put the number.
ex. Word 1 Hello
word 2 hi
Output: the word with the least letters contains 2 letters.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication17;
import java.util.*;
/**
*
* @author Austin
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int PW = 0; int i = 0;
System.out.print("Enter Word one ");
String password = scan.nextLine();
System.out.print("Enter Word two ");
String password2 = scan.nextLine();
System.out.println(" Shortest number is " +PW+ " letters");
}
}