Initialize two character variables in a program and display the characters in alphabetical order.
Answers
Answered by
8
Answer:
Explanation:
class ABC
{
public static void main (String[] args)
{
char item1='x';
char item2='y';
if (item1>item2)
System.out.println(item2+" , "+item1);
else
System.out.println(item1+" , "+item2);
}
}
if first character is s and second is e then output will be e,s.
if first character is a and second is e then output will be a,e
Answered by
1
Answer:
class ABCD
{
public static void main (String[] args)
{
char item1='a';
char item2='b';
if (item1>item2)
System.out.println(item2+" , "+item1);
else
System.out.println(item1+" , "+item2);
}
}
Explanation:
Similar questions