Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I currently programming some calculations and found a weird issue, which I cannot explain.
I'm doing a calculation which I save in a new double field. The thing is, that the finally saved value is not the same than the solution of the formula. I made a screenshot for better understanding.
When I put the whole calculation in a watch, I get the result "1.3050....."
When i check the double afterwards, it has saved "2.87......." which I have no idea, where that comes from.
Does anybody know, why it is behaving like this? For me thats absolutely unexplainable...
Full size: http://i.stack.imgur.com/8nJpn.png
Math.PI/180 should be Math.PI/180.0, dividing doubles by integers will cause some funny things to happen
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Why getText() in JPasswordField was deprecated?
According to this answer for the above question, what I understood was that creating a String object containing the password is a security threat because it may remain in the memory for a while and it is immutable.
So I was wondering,
How easy is it to retrieve something which has been hanging around
in the memory, without a reference or left out for garbage collection?
And how do you do it?
EDIT
As the question has been closed, be kind to share your knowledge by adding a comment, and consider reopening the question if you believe it may get interesting answers in the future. :)
https://en.wikipedia.org/wiki/Heartbleed
This is a good real-world example of things hanging in memory being used for exploitation. There's different ways to do it, so it's good to just make sure things that are valuable aren't being left hanging. Usually these attacks are just guess-and-check. You just keep sending information and piecing together the bits of extra memory you get in return.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm using a string with 80,000,000 characters(1's and 0's) to initialize a BigInteger in Java. It seems to take an extremely long time to initialize(so long in fact that I let it run for an hour before giving up. I've made sure that it is stuck on initialization and I am wondering if a string that large is Too large?
Any help would be greatly appreciated.
Thanks guys.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I've create a database and I'm adding records from GUI.
I also created a delete button.
Once I delete a record and try to add a new one it gives me this error
java.sql.SQLException:
Incorrect integervalue:'javax.swing.JTextField[jTextField16,413,390,19x28,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0,alignme'
for column path at row1
Your database is excpecting an integer, it's getting a string instead.
You are probably doing
textField.toString();
instead of
Integer.parseInt(textField.getText());
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Improve this question
I am trying to develop a small pizza ordering app. I have 3 classes so far and the purpose of them right now is to display 3 menus with the menu items accessible.
Previously I had only one class and that worked just fine however issues started occurring when I split the program to use several classes.
Main.java:
http://pastebin.com/bZJ7Pgdt
MakeFileMenu.java:
http://pastebin.com/wv2Smm6E
MakeFrame.java:
http://pastebin.com/J7DV294P
The errors I am getting are:
Exception in thread "main" java.lang.NullPointerException
at main.MakeFileMenu.MakeMenu(MakeFileMenu.java:24)
at main.Main.start(Main.java:26)
at main.Main.main(Main.java:16)
Furthermore in the Makeframe.java file lines 37, 42, 49 and 57 should be uncommented. I commented them out as they were giving me errors so I thought I will at least try to get the menus to appear.
Anything you guys see out of the ordinary? I double checked the code I can't seem to figure out what could be wrong with it.
Thanks for your help!
The problem is in line:
frame.frame.setJMenuBar(menuBar);
this is because variable frame in frame (frame.frame) is not initialized. You have to initialize it before using.
You either forgot to call makeFrame on frame in MakeFileMenu or you should rename makeFrame to MakeFrame to make it a constructor.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm TAing for an introductory course in Java for freshmen. So, far we've learnt most of Java except the OOPS part. Like we can do methods, loops, control stuctures, arrays, strings, recursion etc..
Since this is their first programming course, they are not aware of fancy datastructures yet.
I have dont most of the regular programs like factorial, fibonacci, primes etc..
I'm looking for some interesting problems in the space without using complex datastructures. Any ideas would be super helpful.
thanks, Vinbot
Project Euler has some problems that you can solve without additional data structures, and all the problems have the nice property of being mathematically interesting. Not all the problems will work for your course, but I bet you can find enough that do, especially among the first few.