Java: Input strings with keyboard class -
I am trying to input input in the Java console application, but I can not seem to run it.
My Java file is thus appearing:
public class Ovning1_3 {public static zero main (string algos []) {string name; System.out.println ("Enter your name"); Name = keyboard.readString (); Println (name); }}
But I get an error:
Exceptions to thread "main" java.lang.Error: unresolved compile problem: no keyboard Can be solved at Ovning1_3.main (Ovning1_3.java:9)
I have a keyboard in my source folder. Class file is I am using Eclipse with Ubuntu.
AnSol compiled problem: That code can not be compiled
You have to import the keyboard, something like
import uitl.keyboard when you have a different package (similar to the current class No packages), you have to import the class. If the class is in the same package then you do not need to import.
Classes are generally grouped.
How do you know the package? Go as a first class. It should be something like package xyz , which means that the current code is in the xyz package. Class will be in a folder named xyz (This is the rule for the package: when you want to put a square in the package, then when it says abc.xyz , the class is a package The announcement should be - the first line of code - to be the package abc.xyz and the file must be present in a folder xyz , which should be in the folder ABC .
Comments
Post a Comment