here is my code, i am having trouble with getting my brakets in the right place so i can run my program. 6 1388 Ganon11 3,652
Recognized Expert Specialist
We are not here to be a programming equivalent of the 'spellchecker'. Put your code into Notepad and indent it properly, and you will be able to see where extra/missing brackets are. Or, let a program do it for you - get an IDE like BlueJ or Eclipse, or even a text formatting editor like Notepad++, put your code in there, and use the bracket highlighting to find your errors, but don't make us do it in our spare time because you're too lazy.
Nepomuk 3,112
Recognized Expert Specialist
Listen, I've told you before: Use the [CODE] ... [/code] tags, when posting code! I'm giving you another warning: Use them! If you don't start using them now, consequences will follow soon.
Greetings,
Nepomuk (Moderator)
Listen, I've told you before: Use the [CODE] ... [/code] tags, when posting code! I'm giving you another warning: Use them! If you don't start using them now, consequences will follow soon.
Greetings,
Nepomuk (Moderator)
What do you mean use the [CODE] ... [/code] tags
But any way i got the brackets fixed. Down at the bottom where i am askin for the user to put true or false. I still cant get that to work, It comes back with this..
Exception in thread "main" java.lang.NullPointerException
at mooredMod2.GuessingGame.main(GuessingGame.java:84)
Can any1 please explain to me what that means and why im getting that.
Thanks
Nepomuk 3,112
Recognized Expert Specialist
What do you mean use the [CODE] ... [/code] tags
It means, either you write [CODE] before and [/code] after your code, or you click on the # button in the editing window. See the code earlier in this thread? It's in a codebox, which was created through the CODE tags.
Anyway, glad to hear, you've solved the bracket problem. The NullPointerException means, that in line 84 there's a variable, which wasn't declared yet. For example, the code - public class Test {
-
public static void main(String[] args) {
-
String myWord;
-
System.out.println(myWord);
-
}
-
}
would throw a NullPointerException, because it knows there IS something called myWord, but it doesn't have a value yet.
Greetings,
Nepomuk
JosAH 11,448
Recognized Expert MVP
For example, the code - public class Test {
-
public static void main(String[] args) {
-
String myWord;
-
System.out.println(myWord);
-
}
-
}
would throw a NullPointerException, because it knows there IS something called myWord, but it doesn't have a value yet.
Local variables need to be initialized before they can be used. The above yields
a compilation error. Even if you initialize that variable to null explicitly no
NullPointerException is thrown because a PrintStream duly prints "null" when
a null value is passed to its print() method.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dave |
last post by:
After following Microsofts admonition to reformat my system before doing a
final compilation of my app I got many warnings/errors upon compiling an rtf
file created in word. I used the Help...
|
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing...
|
by: Colin J. Williams |
last post by:
Python advertises some basic service:
C:\Python24>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
With...
|
by: Corepaul |
last post by:
Missing Help Files
When I enter "recordset" as the keyword and search the Visual Basic Help index,
I get many topics of interest in the resulting list. But there isn't any
information available...
|
by: MyNameIsnt |
last post by:
Can anyone tell me why, when I click on the buttons it register 2
characters on the display?
if you use the right mousebutton it works ok, but the buttons dont
flash??
it works fine without the...
| |
by: James Brown [MVP] |
last post by:
Hi,
I am having trouble understanding how the 'const' modifier affects the
'left-right' rule when deciphering c-declarations:
const int *x; // x is a pointer to a 'const int'
int const *x; ...
|
by: Alex Maghen |
last post by:
This is a bit of an abuse of this group. Just a nit, but I'm hoping someone
really good with Regular Expressions can help me out here.
I need to write a regular expression that will do the...
|
by: fatima.issawi |
last post by:
Hello,
Are brakets () allowed in a file path?
eg.
Passing:
Y:\trak\pdf\98-00_2_123\tst.ps works but
|
by: wuzertheloser |
last post by:
The correct program should look like this:
Total number of voting cards: 55
Votes for candidate 1: 1
Votes for candidate 2: 10
Votes for candidate 3: 8
Votes for candidate 4: 13
Votes...
|
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,...
|
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...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |