Java Point
/*
*/
import java.util.Scanner;
public class StandardName {
public static void main(String[] args) {
String fname,lname,name,name1,name2;
Scanner sb=new Scanner(System.in);
System.out.println("Enter first name :");
name1=sb.next();
System.out.println("Enter last name :");
name2=sb.next();
fname=name1.substring(0,1).toUpperCase()+name1.substring(1).toLowerCase();
lname=name2.substring(0,1).toUpperCase()+name2.substring(1).toLowerCase();
name=fname.concat("").concat(lname);
System.out.println("Name :"+name+"");
}
}
input :
Enter first name :
dheeraj
Enter last name :
kumar
output:
Name :DheerajKumar
Wap a Program that capitalizes a two-word name.For example the
input dheeraj kumar would produce the output Dheeraj Kumar
*/
import java.util.Scanner;
public class StandardName {
public static void main(String[] args) {
String fname,lname,name,name1,name2;
Scanner sb=new Scanner(System.in);
System.out.println("Enter first name :");
name1=sb.next();
System.out.println("Enter last name :");
name2=sb.next();
fname=name1.substring(0,1).toUpperCase()+name1.substring(1).toLowerCase();
lname=name2.substring(0,1).toUpperCase()+name2.substring(1).toLowerCase();
name=fname.concat("").concat(lname);
System.out.println("Name :"+name+"");
}
}
input :
Enter first name :
dheeraj
Enter last name :
kumar
output:
Name :DheerajKumar
Comments
Post a Comment