BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 25 Mar 2013 12:28 AM |
package guiadder;
import javax.swing.JOptionPane;
class apples{ public static void main(String[] args) { String fn = JOptionPane.showInputDialog("Enter first number"); String sn = JOptionPane.showInputDialog("Enter second number"); int num1 = Integer.parseInt(fn); int num2 = Integer.parseInt(sn); int sum = num1 + num2; JOptionPane.showMessageDialog(null, "The answer is" +sum, "Answer", JOptionPane.PLAIN_MESSAGE); } }
This is suppose to make a gui appear in my screen. |
|
|
| Report Abuse |
|
|
| |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |
|
|
| 25 Mar 2013 05:06 AM |
| Compared to C++ this stuff looks easy as cake. xD |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2013 10:08 AM |
Oh, right.
public class apples |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2013 10:09 AM |
"Compared to C++ this stuff looks easy as cake. xD"
The difference is that you can't perform hacks with Java. C++ doesn't give two craps about types of data. Java cares too much. Plus you don't have access to memory in Java, so you don't have to worry about wiping out your entire file system. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2013 10:16 AM |
| Wait I never thought that pointers were all that important, are you saying if you delete one whatever it's tagged to is completely deleted off of your computer? |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2013 10:27 AM |
Imagine all your data stored in a table. This table is filled with references to the components of your entire file system. If you free the pointer that points to the table, no other programs can access ANY data on your computer, rendering it useless.
Pointers are very, very dangerous, but quite fun to use. |
|
|
| Report Abuse |
|
|
|
| 25 Mar 2013 10:30 AM |
| Wow, and they say cops are the only people able to completely delete stuff off of computers >.> |
|
|
| Report Abuse |
|
|