hello we use the class io.*; in our college we use in a unix platform
which is import io*.;
i am trying to code a code so taht i can get a string input i tried ConsoleInput.readString, and also ConsoleInput.readLine()
but still i get an error it says that readString or readLine not found in class io
what can i code
thanks

Recommended Answers

All 3 Replies

Member Avatar for iamthwee

Why don't you use import java.util.Scanner;

A small program to get you started:

import java.io.*;

public class Test
{
    public static void main(String[] args)
    {
        try
        {
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            String userInput = in.readLine();
            System.out.println("\n\nUser entered -> " + userInput);
        }
        catch(IOException e)
        {
            System.out.println("IOException has been caught");
        }
    }
}

The same way you're reading the doubles, but without the parsing, of course.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.