Java Program

+1 Arnab Banerjee · February 14, 2015
Write a java program where Space marks or whit spaces are not counted as characters. 

Post a Reply

Replies

Oldest  Newest  Rating
0 Arnab Banerjee · February 15, 2015
Thanks mate  /// 
+1 Arnab Banerjee · February 15, 2015
import java.util.Scanner;
public class bank {
String fn;
int n;
Scanner x = new Scanner(System.in);


void setAccount(){
try{
System.out.println("Enter user's first name ");
fn = x.nextLine();

 


if (fn.charAt(n+1) == (n) ){
setAccount(); 

}

}

catch(Exception e){
setAccount();
}
  }
}

This is my approach sam.. 
I want to make sure if user enters no string but only space marks it won't take that..  :)
I have tried with trim, but it is not working. 
  • 1

Java / Android Development

106,924 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator