please help me i want to make a program where the program can check my input. ex 1: my input(string) : myprogram then my program print "your input containing 'p'" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

please help me i want to make a program where the program can check my input. ex 1: my input(string) : myprogram then my program print "your input containing 'p'"

1st Sep 2016, 2:46 PM
Farhan Sindy
Farhan Sindy - avatar
8 Answers
+ 3
use control statement for this dudr
2nd Sep 2016, 2:25 AM
Shubham Priyesh
Shubham Priyesh - avatar
+ 3
switch/case will be great for this!!
2nd Sep 2016, 2:26 AM
Shubham Priyesh
Shubham Priyesh - avatar
+ 3
class Simple { public static void main (String args []) { Char c; System.out.println ("Enter Any Letter"); c=dis.readLine (); switch (c) { case 'A' : System.out.println ("You Entered A"); break; case 'B' : System.out.println ("You Entered B"); break; case default : System.out.println ("Invalid Entry"); } } }
2nd Sep 2016, 2:34 AM
Shubham Priyesh
Shubham Priyesh - avatar
+ 3
as #code below string str; System.out.println (" Your prefered Letter "); str=dis.readLine(); switch (str) case shubham: System.out.println("this is the name of programmer of this program"); break; case abc: System.out.println("details about abc as u want "); break; default : System.out.println (" Default or your word ");
2nd Sep 2016, 1:31 PM
Shubham Priyesh
Shubham Priyesh - avatar
+ 2
ex : i want my program can check one letter in one word
1st Sep 2016, 4:01 PM
Farhan Sindy
Farhan Sindy - avatar
+ 2
how about if i want to count how many vocal letter and non-vocal letter in my input?
2nd Sep 2016, 6:01 AM
Farhan Sindy
Farhan Sindy - avatar
+ 1
could u be more perticular?
1st Sep 2016, 3:53 PM
Suhail Pappu
Suhail Pappu - avatar
+ 1
it will just need to change the datatype and cases of the switch!!
2nd Sep 2016, 1:25 PM
Shubham Priyesh
Shubham Priyesh - avatar