Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Assignment Char Count

807607Oct 24 2006 — edited Oct 25 2006
This is for school .

I am just trying to create a program to count the charcters in the string you enter. What is wrong? Please keep it n00b level.

They want it done this way so please dont ask why am I not using swing this that and the other. Thanx

import java.io.*;
import java.util.*;

public class CharCounter
{

public static void main(String[] args)
{
	String str1;
	int length() = str1;

	System.out.print("Enter a String: ");
	  str1 = dataIn.readLine();

	if(str1.length() <= 0)
	{
	System.out.print("No Text entered: ");
	}
	else
	{
	 do
	 {
	 System.out.print(length());
	 }
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 22 2006
Added on Oct 24 2006
6 comments
150 views