
-----------------------------------
shlubster
Mon Sep 08, 2008 5:25 pm

Unusual Error Message PLZ HELP
-----------------------------------
Hi

I am new to the java programming language
( 1 month of on and off programming and now im really trying to learn)

and when i was programming i got this error in my output area  when trying to execute a program
i am using JCreator LE

--------------------Configuration: --------------------
How Old are You? 
12
Do you have a coupon? (Y/N) 
Exception in thread "main" java.lang.NullPointerException
    at TicketDiscout.main(TicketDiscout.java:23)

Process completed.

If you recognize this error please help, if you need my full code then tell me
Thanks

-----------------------------------
Insectoid
Mon Sep 08, 2008 5:33 pm

RE:Unusual Error Message PLZ HELP
-----------------------------------
Yes, we really need your code (I don't even know Java, and I know we need your code). Giving us the output doesn't matter, we can figure out the output on our own (well, not me, but people who know Java)

I suppose you broke some rule or other in the language...


Anyways, hope somebody comes along and helps you!

-----------------------------------
btiffin
Mon Sep 08, 2008 5:56 pm

RE:Unusual Error Message PLZ HELP
-----------------------------------
Hi,

Yep, we'll need to see the code.  And as it turns out, a null pointer exception is not that unusual.  Not during development at least.

Line 23 inside TicketDiscount.java is trying to access something through a variable that isn't pointing anywhere.

Cheers,
Brian
P.S.  When you post your code, use bbcode code tags.

They look like [code]  ...  [/code]


-----------------------------------
Witchcraft
Mon Sep 08, 2008 8:24 pm

RE:Unusual Error Message PLZ HELP
-----------------------------------
Shlubster, are you by any chance the friend of the really good programmer who goes by the name whos the who? He mention something about you. If your half as good as him, then I can't wait to see what kinds of programs you can write. I love his games, the last one he posted was amazing, the graphics aren't that great but its deep, and I might even say that I prefer it over games like bioshock, call of duty, and crysis! Anyways let me know soon.

-----------------------------------
syntax_error
Mon Sep 08, 2008 8:31 pm

Re: RE:Unusual Error Message PLZ HELP
-----------------------------------
Shlubster, are you by any chance the friend of the really good programmer who goes by the name whos the who? He mention something about you. If your half as good as him, then I can't wait to see what kinds of programs you can write. I love his games, the last one he posted was amazing, the graphics aren't that great but its deep, and I might even say that I prefer it over games like bioshock, call of duty, and crysis! Anyways let me know soon.

There is a pm system for this type of messages, the topic area is not a chat room. 
Please do not take this in a harsh manner.

-----------------------------------
Witchcraft
Mon Sep 08, 2008 9:02 pm

RE:Unusual Error Message PLZ HELP
-----------------------------------
my mistake, I thought I clicked pm, but I must not have loaded the page, and I didn't realize, causing me to post on the thread. Once again sorry about that irrelevant comment, (it was suppost to be a joke, cause he actually knows me)

anyways back on topic, these two previous commenters are right. YOU NEED TO SHOW YOUR CODE IF YOU WANT HELP!

-----------------------------------
shlubster
Tue Sep 09, 2008 7:42 pm

Re: Unusual Error Message PLZ HELP
-----------------------------------
Hey

this is my code

/**
 * @(#)TicketDiscount.java
 *
 *
 * @author 
 * @version 1.00 2008/9/9
 */

import java.util.Scanner;

public class TicketDiscount {

    public static void main(String args[]) {
    	Scanner Scan = new Scanner(System.in);
    	int age;
    	double price = 2.00;
    	char reply;
    	
    	System.out.println("How old are you?");
    	age = Scan.nextInt();
    	System.out.println("Do you have a coupon? Y/N");
    	reply = Scan.findInLine(".").charAt(0);
    	
    	if (age >= 12 && age 12 || age