This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes please help with simple problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help with simple problem" Watch "please help with simple problem" New topic
Author

please help with simple problem

julio torres
Greenhorn

Joined: Oct 19, 2000
Posts: 2
need to do a program that reads random number and then display
the string on character letter by letter
my code so far
import java.io.*;
public class a2n2
{

public static void main (String [] args)throws IOException
{
String s;


BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter your Name:");
s = kb.readLine();

int count= s.length();
int pos=0;
char chs= s.charAt(pos);
chs = s.charAt(pos);
//System.out.println("letter:" + chs);

for ( pos=0; pos <= chs; count+);
{
count=pos + count;
System.out.println("display:"+ count);
}
}
}
please give me a hint on how to do this
i am stock on a simple program
julio torres
Greenhorn

Joined: Oct 19, 2000
Posts: 2
Originally posted by julio torres:
Sorry for the miss typo it is a random String to display
characters of the string one by one
need to do a program that reads random number and then display
the string on character letter by letter
my code so far
import java.io.*;
public class a2n2
{

public static void main (String [] args)throws IOException
{
String s;


BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter your Name:");
s = kb.readLine();

int count= s.length();
int pos=0;
char chs= s.charAt(pos);
chs = s.charAt(pos);
//System.out.println("letter:" + chs);

for ( pos=0; pos <= chs; count+);
{
count=pos + count;
System.out.println("display:"+ count);
}
}
}
please give me a hint on how to do this
i am stock on a simple program

Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Julio,
Try a for-loop to output the letters.

Hope that helps.
------------------
Jane


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
The output of this program as written:
Enter your Name:
_
^
(cursor)
You have to Ctrl-C to interrupt it.
[This message has been edited by Marilyn deQueiroz (edited October 20, 2000).]


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
Don't get me started about those stupid light bulbs.
 
subject: please help with simple problem
 
Similar Threads
Counting one character at a time from a file
Suggestions on fastest way to parse a String?
Passing Vector elements to an array
[Easy] Shift String
Which way is efficient, declaring a function as static or creating an object?