character counter

character counter

View Answers

March 29, 2009 at 5:31 AM

hy katy,


import java.io.*;
class counter
{
public counter()
{
System.out.print("Enter ur name:");
try{
BufferedReader in2=new BufferedReader(new InputStreamReader(System.in));
String name = in2.readLine();
char c[] = name.toCharArray();
if(name.length() <=4 ){
System.out.println("Name Length must be above 3 characters!!");
}
else{
System.out.println("First Three Character is:"+c[0]+c[1]+c[2]);
}

}catch(IOException io){
System.out.println(io);}
}
public static void main(String args[])
{
new counter();
}
}




this code will full fill your require, i hope
thnx.




satish,
[email protected]

March 30, 2009 at 3:02 PM

hi katy,

You can also used substring() method of string object to show first three characters of entered name.

import java.io.*;
class GetCharacter
{
public GetCharacter()
{
System.out.print("Enter name:");
try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String name = br.readLine();
String st=name.substring(0,3);
System.out.println(st);
}
catch(Exception e){}
}
public static void main(String args[])
{
new GetCharacter();
}
}

Thanks
RoseIndia Team









Related Tutorials/Questions & Answers:
character counter - Java Beginners
character counter  how to show only first three characters of the entered(by user) name?  hy katy, import java.io.*; class counter { public counter() { System.out.print("Enter ur name:"); try
Servlet Counter
{ int counter = 0; public void doGet(HttpServletRequest request...(); counter++; pw.println("At present the value of the counter is " + counter); } } In the above example, which keeps track how many times the servlet
Advertisements
Counter
ModuleNotFoundError: No module named 'Counter'
ModuleNotFoundError: No module named 'Counter'  Hi, My Python... 'Counter' How to remove the ModuleNotFoundError: No module named 'Counter... to install padas library. You can install Counter python with following command
ModuleNotFoundError: No module named 'Counter'
ModuleNotFoundError: No module named 'Counter'  Hi, My Python... 'Counter' How to remove the ModuleNotFoundError: No module named 'Counter... to install padas library. You can install Counter python with following command
ModuleNotFoundError: No module named 'Counter'
ModuleNotFoundError: No module named 'Counter'  Hi, My Python... 'Counter' How to remove the ModuleNotFoundError: No module named 'Counter... to install padas library. You can install Counter python with following command
Character count by while loop
Character count by while loop  Write the program to count the number...(); for(int counter =0;counter<third.length;counter++){ char ch= third[counter...]) flag=true; } if(!flag){ System.out.println("Character :"+ch+" occurs "+count
Character Class
Character Class  Character defines the forDigit();,digit()methods..how can these b used and wht is radix point signifies here...in the arguments of these two???..pls answer a code on this with radix .. are these methods also
underscore as character
underscore as character  how can i consider _ as a character instead of wildcard character? my problem is like this i have 20 records as follows manohar 1234455 manohar 453635 manohar 345454 manohar_1234455 now when i am
Character class
Character class   Character defines the forDigit();,digit()methods..how can these b used and wht does radix point signify here.i want to knw what basically radix is??here in the arguments of these two???because i tried runnin
Counter program for java
Counter program for java  The problem is to count from 000 to 444 with recursion. The maximum digit is 4 so that the program will count from 000,001,002,003,004,010, 011 and so on. How can I solve
count the repeated character in one string
count the repeated character in one string  to find the how character...=str.replaceAll(" ", ""); char[]third =st.toCharArray(); for(int counter =0;counter<third.length;counter++){ char ch= third[counter]; int count=0
How to convert entity character to html character
How to convert entity character to html character  How to convert entity character to html character
counter - JSP-Interview Questions
********///////// A page with a counter This page has been visited: times. This counter never increases its value
ModuleNotFoundError: No module named 'counter-robots'
ModuleNotFoundError: No module named 'counter-robots'  Hi, My... named 'counter-robots' How to remove the ModuleNotFoundError: No module named 'counter-robots' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'incremental-counter'
ModuleNotFoundError: No module named 'incremental-counter'  Hi, My... named 'incremental-counter' How to remove the ModuleNotFoundError: No module named 'incremental-counter' error? Thanks   Hi
ModuleNotFoundError: No module named 'moca-counter'
ModuleNotFoundError: No module named 'moca-counter'  Hi, My Python... 'moca-counter' How to remove the ModuleNotFoundError: No module named 'moca-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'morris-counter'
ModuleNotFoundError: No module named 'morris-counter'  Hi, My... named 'morris-counter' How to remove the ModuleNotFoundError: No module named 'morris-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pdf-counter'
ModuleNotFoundError: No module named 'pdf-counter'  Hi, My Python... 'pdf-counter' How to remove the ModuleNotFoundError: No module named 'pdf-counter' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'tag_counter'
ModuleNotFoundError: No module named 'tag_counter'  Hi, My Python... 'tag_counter' How to remove the ModuleNotFoundError: No module named 'tag_counter' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'verb_counter'
ModuleNotFoundError: No module named 'verb_counter'  Hi, My Python... 'verb_counter' How to remove the ModuleNotFoundError: No module named 'verb_counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'words_counter'
ModuleNotFoundError: No module named 'words_counter'  Hi, My... 'words_counter' How to remove the ModuleNotFoundError: No module named 'words_counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'words_counter'
ModuleNotFoundError: No module named 'words_counter'  Hi, My... 'words_counter' How to remove the ModuleNotFoundError: No module named 'words_counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'counter-caller'
ModuleNotFoundError: No module named 'counter-caller'  Hi, My... named 'counter-caller' How to remove the ModuleNotFoundError: No module named 'counter-caller' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'django-counter'
ModuleNotFoundError: No module named 'django-counter'  Hi, My... named 'django-counter' How to remove the ModuleNotFoundError: No module named 'django-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'incremental-counter'
ModuleNotFoundError: No module named 'incremental-counter'  Hi, My... named 'incremental-counter' How to remove the ModuleNotFoundError: No module named 'incremental-counter' error? Thanks   Hi
ModuleNotFoundError: No module named 'counter-caller'
ModuleNotFoundError: No module named 'counter-caller'  Hi, My... named 'counter-caller' How to remove the ModuleNotFoundError: No module named 'counter-caller' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'error-counter'
ModuleNotFoundError: No module named 'error-counter'  Hi, My... 'error-counter' How to remove the ModuleNotFoundError: No module named 'error-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'line-counter'
ModuleNotFoundError: No module named 'line-counter'  Hi, My Python... 'line-counter' How to remove the ModuleNotFoundError: No module named 'line-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'moca-counter'
ModuleNotFoundError: No module named 'moca-counter'  Hi, My Python... 'moca-counter' How to remove the ModuleNotFoundError: No module named 'moca-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'moca-counter'
ModuleNotFoundError: No module named 'moca-counter'  Hi, My Python... 'moca-counter' How to remove the ModuleNotFoundError: No module named 'moca-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'page-counter'
ModuleNotFoundError: No module named 'page-counter'  Hi, My Python... 'page-counter' How to remove the ModuleNotFoundError: No module named 'page-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pdf-counter'
ModuleNotFoundError: No module named 'pdf-counter'  Hi, My Python... 'pdf-counter' How to remove the ModuleNotFoundError: No module named 'pdf-counter' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'reference_counter'
ModuleNotFoundError: No module named 'reference_counter'  Hi, My... named 'reference_counter' How to remove the ModuleNotFoundError: No module named 'reference_counter' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'rip-counter'
ModuleNotFoundError: No module named 'rip-counter'  Hi, My Python... 'rip-counter' How to remove the ModuleNotFoundError: No module named 'rip-counter' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'tipfy.ext.sharded_counter'
ModuleNotFoundError: No module named 'tipfy.ext.sharded_counter'  Hi...: No module named 'tipfy.ext.sharded_counter' How to remove the ModuleNotFoundError: No module named 'tipfy.ext.sharded_counter' error? Thanks  
ModuleNotFoundError: No module named 'word-counter'
ModuleNotFoundError: No module named 'word-counter'  Hi, My Python... 'word-counter' How to remove the ModuleNotFoundError: No module named 'word-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'words_counter'
ModuleNotFoundError: No module named 'words_counter'  Hi, My... 'words_counter' How to remove the ModuleNotFoundError: No module named 'words_counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'words_counter'
ModuleNotFoundError: No module named 'words_counter'  Hi, My... 'words_counter' How to remove the ModuleNotFoundError: No module named 'words_counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'words_counter'
ModuleNotFoundError: No module named 'words_counter'  Hi, My... 'words_counter' How to remove the ModuleNotFoundError: No module named 'words_counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'calorie-counter'
ModuleNotFoundError: No module named 'calorie-counter'  Hi, My... named 'calorie-counter' How to remove the ModuleNotFoundError: No module named 'calorie-counter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'counter-robots'
ModuleNotFoundError: No module named 'counter-robots'  Hi, My... named 'counter-robots' How to remove the ModuleNotFoundError: No module named 'counter-robots' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'distributed-counter'
ModuleNotFoundError: No module named 'distributed-counter'  Hi, My... named 'distributed-counter' How to remove the ModuleNotFoundError: No module named 'distributed-counter' error? Thanks   Hi
ModuleNotFoundError: No module named 'error-counter'
ModuleNotFoundError: No module named 'error-counter'  Hi, My... 'error-counter' How to remove the ModuleNotFoundError: No module named 'error-counter' error? Thanks   Hi, In your python
replace character in php
replace character in php  PHP script that replace character
How to convert entity character to html character
How to convert entity character to html character  Please help me to "convert entity character to html character" in java. If possible please provide source code which take String as input and return as String
Character Wrapper Class.
Character Wrapper Class.  what are Mirrored Unicode Characters?? and whats the use of "isMirrored(ch);method ??.where ch is any character argument.... There are special characters in UNICODE to achieve the RTL. Such character is the Mirroring
character as command line arguments
character as command line arguments  public class testing { public static void main(String args[]) { char a; a=args[0]; System.out.println("character is:"+a); } } what will be the above program output
php remove last character
php remove last character  to remove the last character, i used the trim function which is not working
find the first character is vowel or not
find the first character is vowel or not  hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check

Ads