473,624 Members | 2,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Keyboard.readIn t()

kaleeswaran
132 New Member
hi!

i tried to get the input through keyboard using keyboard.readIn t() 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.prin tln("Enter the number:");
number=keyboard .readInt();
sum=0;
num=number;
while(num>0)
sum+=num--;
System.out.prin tln("The sum of the first"+number+" integer is"+sum+".");
}

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

i tried to get the input through keyboard using keyboard.readIn t() 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.prin tln("Enter the number:");
number=keyboard .readInt();
sum=0;
num=number;
while(num>0)
sum+=num--;
System.out.prin tln("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.readI nt()"
Apr 3 '07 #3
r035198x
13,262 MVP
fine how to use this method "Keyboard.readI nt()"
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.prin t("Enter ten numbers: ");
for (int i=0; i<10; i++)
counts[i]=Keyboard.readI nt();
for (int i=0; i<10; i++)
System.out.prin t(counts[9-i] + " ");
System.out.prin tln();
}
}
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.prin t("Enter ten numbers: ");
for (int i=0; i<10; i++)
counts[i]=Keyboard.readI nt();
for (int i=0; i<10; i++)
System.out.prin t(counts[9-i] + " ");
System.out.prin tln();
}
}
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
2515
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. The typist was often too fast and the print bars would jam. I heard the same story when I took a typing class. This led me to wonder if 't' might have been moved from the home row for the same reason. 'E is dit and T is dash, under middle...
13
2757
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 the space occupied by the keys on the right, so the reach to the mouse is not so bad, but the way they chose to do it? Ah - I see. Since most of what we type will simply be deleted at some point, let's make sure the Delete key is big and easy...
23
7721
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 buffer ? are they same ? thanks ^^
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 <limits.h> #define P printf #define R return
7
10627
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 were a keyboard. I need to be able to identify input from the scanner and keyboard independently. I've looked at DirectX.DirectInput, and using user32.dll to hook into the keyboard messages, but neither method seems to allow for identification of...
0
6664
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 my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles. however, everytime I use the readfile function I am getting "object reference not set to an instant...
2
8753
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 my keyboard. the USB keyboard is detected as HID keyboard device. the program finds the keyboard if it is attached. and I am getting valid handles. however, everytime I use the readfile function I am getting "object reference not set to an instant...
331
14818
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 most versatile text editor. And, besides text editing, it also serves as a
1
13223
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
8677
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.