Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Keyin

  Asked By: Bogart    Date: Jan 06    Category: Java    Views: 2034
  

I am a new comer in Java Programming. Usually I use
PHP, Perl and MySQL.

I need you help. I have a problem.

I use "Keyin" in my program. Each time I compile my
code I get this error message:
"
patrixlinux@patrix:~/arsip/My> javac cobain.java
cobain.java:5: cannot resolve symbol
symbol : method include (java.lang.String)
location: class cobain
include("java.lang.*");
^
cobain.java:8: cannot resolve symbol
symbol : variable Keyin
location: class cobain
userinput = Keyin.inInt("Enter your
option : ");
^
2 errors
patrixlinux@patrix:~/arsip/My>
"

Please tell me where is the mistake.

This is my code:
public class cobain
{
public static void main(String[] args)
{
include("java.lang.*");

int userinput;
userinput = Keyin.inInt("Enter your option : ");

}

}

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Lughaidh Fischer     Answered On: Jan 06

The first error  indicates that the method  include() doesn't exist. If you want
to import in java  you put import package.ClassName before your class  declaration
at the top of your Java source code. Take note that you should not import
java.lang.* as it is already imported by default.

Second you need to actually have either a Keyin class with a static  method
inInt() or a variable  called Keyin which is an instance of a class which has the
method inInt().

Based on what you have written I suggest you go and read
java.sun.com/.../index.html

 
Answer #2    Answered By: Aalia Arain     Answered On: Jan 06

Java has much differences with PHP. I suggest, if you
want to learn a new programming  language, read the
example program's source code  and write it. Just write
the code you read. Then, please take attention, how
the new language differ from the old.

Second, you can use the java  IDE or Text Editor that
support syntax highlighting (such as editplus). This
will help  you to determine the syntax error  before you
compile your code.

The last, read the books or java tutorial as Anthony
Eden suggested.

 
Answer #3    Answered By: Terence Mitchell     Answered On: Jan 06

Java is a bit weird. Only as input function from
keyboard we have to write a program  for that. First
time for me experiencing make an keyboard input
program.

 
Answer #4    Answered By: Adalwin Fischer     Answered On: Jan 06

import java.lang.*;
public class  cobain
{
public static  void main(String[] args)
{
int userinput;
userinput = Keyin.inInt("Enter your option  : ");

}

}

 
Didn't find what you were looking for? Find more on Keyin Or get search suggestion and latest updates.

Related Topics:



Tagged:  

 
 
 

Related Post