Skip to main content
added 1 character in body
Source Link
Akash Thakare
  • 23k
  • 11
  • 64
  • 89
switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters } 

NOTE

Moreover for conactingconcacting String you should use StringBuilderStringBuilder (As Maroun Maroun) has already suggested and use stringBuilder.append('char') method to add your character to String builder directly no need to use String (i.e "a","b" etc.).

switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters } 

NOTE

Moreover for conacting String you should use StringBuilder (As Maroun Maroun) has already suggested and use stringBuilder.append('char') method to add your character to String builder directly no need to use String (i.e "a","b" etc.).

switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters } 

NOTE

Moreover for concacting String you should use StringBuilder (As Maroun Maroun) has already suggested and use stringBuilder.append('char') method to add your character to String builder directly no need to use String (i.e "a","b" etc.).

added 266 characters in body
Source Link
Akash Thakare
  • 23k
  • 11
  • 64
  • 89
switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters } 

NOTE

Moreover for conacting String you should use StringBuilder (As Maroun Maroun) has already suggested and use stringBuilder.append('char') method to add your character to String builder directly no need to use String (i.e "a","b" etc.).

switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters } 
switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters } 

NOTE

Moreover for conacting String you should use StringBuilder (As Maroun Maroun) has already suggested and use stringBuilder.append('char') method to add your character to String builder directly no need to use String (i.e "a","b" etc.).

Source Link
Akash Thakare
  • 23k
  • 11
  • 64
  • 89

switch (getChar)//<--You are passing charcter in switch case //but checking for 1,2 int as case 1,2... 

What you need to change is your case

as in switch you will be passing characters like a,b,c...

switch(getchar) { case 'a': //yourwork break; //do this for all letters }