Below example will explain
import java.util.*;
import java.io.*;
class StringTest
{
public static void main(String args[]) throws Exception
{
InputStreamReader r=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(r);
System.out.println("Enter your name");
String name=br.readLine();
System.out.println("Welcome "+name);
String s1;
String s2;
Scanner sc=new Scanner(System.in);
System.out.print("Enter First String : ");
s1=sc.nextLine();
System.out.print("Enter Second String : ");
s2=sc.nextLine();
String s3=s1+s2;
System.out.println("Result : "+s3);
int l=s3.length();
System.out.println("Length : "+l);
String s4=s3.toUpperCase();
System.out.println("Result upper : "+s4);
System.out.print("Enter character : ");
int a=System.in.read();
System.out.println((char)a);
}
}
- String
- Scanner
- BufferedReader
- length
- uppercase
import java.util.*;
import java.io.*;
class StringTest
{
public static void main(String args[]) throws Exception
{
InputStreamReader r=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(r);
System.out.println("Enter your name");
String name=br.readLine();
System.out.println("Welcome "+name);
String s1;
String s2;
Scanner sc=new Scanner(System.in);
System.out.print("Enter First String : ");
s1=sc.nextLine();
System.out.print("Enter Second String : ");
s2=sc.nextLine();
String s3=s1+s2;
System.out.println("Result : "+s3);
int l=s3.length();
System.out.println("Length : "+l);
String s4=s3.toUpperCase();
System.out.println("Result upper : "+s4);
System.out.print("Enter character : ");
int a=System.in.read();
System.out.println((char)a);
}
}
No comments:
Post a Comment