473,499 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keyboard.readInt()

kaleeswaran
132 New Member
hi!

i tried to get the input through keyboard using keyboard.readInt() method
but after compilation error shows "variable keyboard undefined"
i don't know how to solve the pbm..plzz tell me...and this is my pgm:
import java.io.*;
import keyboard.*;
public class test
{
public static void main(String args[])
{
int number;
int sum;
int num;
System.out.println("Enter the number:");
number=keyboard.readInt();
sum=0;
num=number;
while(num>0)
sum+=num--;
System.out.println("The sum of the first"+number+"integer is"+sum+".");
}

}
Apr 3 '07 #1
6 16665
r035198x
13,262 MVP
hi!

i tried to get the input through keyboard using keyboard.readInt() method
but after compilation error shows "variable keyboard undefined"
i don't know how to solve the pbm..plzz tell me...and this is my pgm:
import java.io.*;
import keyboard.*;
public class test
{
public static void main(String args[])
{
int number;
int sum;
int num;
System.out.println("Enter the number:");
number=keyboard.readInt();
sum=0;
num=number;
while(num>0)
sum+=num--;
System.out.println("The sum of the first"+number+"integer is"+sum+".");
}

}
Where did you get the keyboard package from? You should ask there how to use it first because it is not part of the standard Java API.
Apr 3 '07 #2
kaleeswaran
132 New Member
fine how to use this method "Keyboard.readInt()"
Apr 3 '07 #3
r035198x
13,262 MVP
fine how to use this method "Keyboard.readInt()"
Check your case. In the code you have a small k.
Apr 3 '07 #4
kaleeswaran
132 New Member
yes i got it.
thnk you...
Apr 3 '07 #5
Ouzair
1 New Member
HI there...

Actually, am getting the same problem here but it is not a prob with my case. Can i please get a solution?? Thanks a lot!

Here is the prgm:

class Simple2 {
public static void main (String[] arg) {
int[] counts = new int[10];
System.out.print("Enter ten numbers: ");
for (int i=0; i<10; i++)
counts[i]=Keyboard.readInt();
for (int i=0; i<10; i++)
System.out.print(counts[9-i] + " ");
System.out.println();
}
}
Jul 23 '08 #6
r035198x
13,262 MVP
HI there...

Actually, am getting the same problem here but it is not a prob with my case. Can i please get a solution?? Thanks a lot!

Here is the prgm:

class Simple2 {
public static void main (String[] arg) {
int[] counts = new int[10];
System.out.print("Enter ten numbers: ");
for (int i=0; i<10; i++)
counts[i]=Keyboard.readInt();
for (int i=0; i<10; i++)
System.out.print(counts[9-i] + " ");
System.out.println();
}
}
Have you imported the Keyborad class? It's not part of the standard Java APIs.
Jul 24 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2500
by: skearney | last post by:
When I was in boy scouts, as part of learning Morse code, I was told that the inventor of the typewriter originally put the letter 'e' under the left middle finger, just below its present position....
13
2727
by: Steve Jorgensen | last post by:
Well, it seems that Microsoft, or whatever powers that be have decided it's time for us to have yet another standard keyboard layout change. I think I see that the point of this one was to reduce...
23
7673
by: herrcho | last post by:
What's the difference between STDIN and Keyboard buffer ? when i get char through scanf, i type in some characters and press enter, then, where do the characters go ? to STDIN or Keyboard...
20
404
by: RoSsIaCrIiLoIA | last post by:
I a poor beginner defy this NG to write an ANSI-C portable int readint(FILE* fp); better of my in the treatment of a stream ______________ #include <stdio.h> #include <assert.h> #include ...
7
10595
by: Don Riesbeck Jr. | last post by:
I'm working on an application (OEM) using C# that utilizes input from a keyboard, and USB Barcode Scanner. The scanner is a HID Keyboard device, and input from it is sent to the system as if it...
0
6601
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
2
8738
by: rs | last post by:
Hi guys, I am trying to read from a USB keyboard using vb.net and HID classes. the USB keyboard is not my primary keyboard. I have a ps2 keyboard connected and is detected in device manager as...
331
14671
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
1
13208
by: Techno3000 | last post by:
import java.io.*; import java.awt.*; import hsa.Console; public class Calculator { static Console c; public static void main (String args) throws IOException
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.