Java – Cannot find symbol error bufferedreader

java

THIS IS MY CODE

 import java.IO.*;  class jed {     public static void main (String args[]){    BufferedReader datain = new BufferedReader(new InputStreamReader(System.in));    String name =" ";    System.out.print("What is your name?:");     try{        name = datain.readline();     } catch(IOException e) {       System.out.print("Error");    }     System.out.print("Your name is" + name); } }

THIS IS THE ERROR

 D:\>javac jed.java jed.java:1: error: package java.IO does not exist import java.IO.*; ^ jed.java:4: error: cannot find symbol BufferedReader datain = new BufferedReader(new InputStreamReader(System.in)); ^   symbol:   class BufferedReader   location: class jed jed.java:4: error: cannot find symbol BufferedReader datain = new BufferedReader(new InputStreamReader(System.in)); ^   symbol:   class BufferedReader    location: class jed jed.java:4: error: cannot find symbol BufferedReader datain = new BufferedReader(new InputStreamReader(System.in));^   symbol:   class InputStreamReader    location: class jed jed.java:10: error: cannot find symbol catch(IOException e){^   symbol:  class IOException                                                      location: class jed 5 errors

I will appreciate any help I can get to fix this issue. Thank you

Best Solution

Java is case sensitive.

Your import is wrong. Change

import java.IO.*;

to

import java.io.*;

In defence of the compiler it does actually tell you the problem clearly:

error: package java.IO does not exist import java.IO.*;