07 July, 2019

Write a java program to compare two string using command line arguments.

Write a java program to compare two string using command line arguments,command line arguments,java,command line,java command line arguments,java program to add two numbers using command line arguments,what is command line argument in java,command line arguments in java,java program to pass value as command line arguments,java (programming language),write a program to count vowels in a string in java,java program for summing of command line arguments
class CommandLineCheckEqualityOfString
{
	public static void main(String ar[])
	{
		int arLength=ar.length;
		if(arLength==2)
		{
			String s1=ar[0];
			String s2=ar[1];
	
			if(s1.equals(s2))
			{
				System.out.println("Both String are Equal");
			}
			else
			{
				System.out.println("Both String are Different");
			}
		}
		else if(arLength==1)
		{
			System.out.println("You entered Only one String");
		}
		else if(arLength>2)
		{
			System.out.println("You entered more then 2 String");
		}
		else
		{
			System.out.println("You not entered Any String");
		}
	}
}
12
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post