Results 1 to 4 of 4
Thread: Name Printer Program
- 10-12-2010, 09:12 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
Name Printer Program
Hi,
I am trying to write a simple program which allows a user to enter their name.
This is what I've coded so far:
However, when I try to compile and run the program in cmd, I get 1 error: String name = in.next();Java Code:import java.util.Scanner; public class NamePrinter { public static void main(String[] args) { System.out.print("Please enter your name: "); String name = in.next(); } }
.................................................. .................................................. ...................^
The error is pointing to the 'i'. Does that mean something is wrong with the i or does that mean something is wrong with that line?
I am confused with what I'm doing and I am unsure of what the error means when the ^ points to a particular part.
Thanks for your help.Last edited by makeawish; 10-12-2010 at 09:15 PM.
- 10-12-2010, 09:18 PM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,540
- Rep Power
- 11
What is the compiler message? These messages are always helpful.
- 10-12-2010, 10:27 PM #3
Senior Member
- Join Date
- Oct 2010
- Posts
- 316
- Rep Power
- 3
It means you are calling a method which does not exist for the variable "in". What is "in"?
Won't say any more than that ;).
Regards.
- 10-17-2010, 04:08 PM #4
Member
- Join Date
- Oct 2010
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
How to connect to printer from a stand alone java program?
By vidya.c@tcs.com in forum New To JavaReplies: 0Last Post: 03-01-2010, 05:49 AM -
how to add a printer option in a java program?
By Allgorythm in forum New To JavaReplies: 1Last Post: 02-20-2010, 12:21 AM -
How to change paper source or printer tray of a printer in java code
By JAVA_ER in forum Advanced JavaReplies: 2Last Post: 02-20-2009, 07:25 AM -
please help on java program for printer : this printer is connected to system which
By for453 in forum Java 2DReplies: 0Last Post: 08-09-2007, 06:30 AM -
jsp program for client side printer to print these 2 strings on 3/3
By for453 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 08-07-2007, 04:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks