# Java programming

Discussion in 'Computer Science & Culture' started by draqon, Jan 20, 2009.

Not open for further replies.
1. ### draqonBannedBanned

Messages:
35,006
I was wondering...is there a code I can type in JGrasp or maybe a setting I can change so that I can view the result of the code I compiled. Like I compile the thing and there are no errors, but the thing just flashes in 1/100 of a second in the screen and I cannot make it freeze so that I can analyze what the output is.

3. ### draqonBannedBanned

Messages:
35,006
ok I solved my issue. Is JGrasp, go to "build" and select "run in MSDOS window"

and click enter when MSDOS comes up.

5. ### StryderKeeper of "good" ideas.Valued Senior Member

Messages:
13,102
The other option Draq, would be to type CMD into the Run/Search dialogue to bring up the Command window. Then execute Build from there. It's suggested you use the full path to execute the command rather than just the command "Build" from the folder. (The main reason is due to original ways to circumvent the correct file from being loaded by aliasing, although most of those problems have been patched over the years. It's still a good security measure.)

7. ### AbsaneRocket SurgeonValued Senior Member

Messages:
8,989
It's been a long time since I done any programming. When I was 14 I started to get hard-core into teaching myself VB and C++. Then in my senior year of high school I took a CP class for an easy A (I relearned C++). It wasn't until about a year ago I had to re-do it again for a cryptography class to factor an arbitrarily large number using Pollard's Rho Method. I used a library called NTL.. or "Number Theory Library" to work with arbitrarily large numbers.

That's off-topic... sorry.

Doesn't Java look a lot like C/C++?

8. ### draqonBannedBanned

Messages:
35,006
yes Absane...now we all know how intelligently superior to us all you are...that you did this stuff back in your high school, middle school perhaps.

Yes Java looks like C++, in fact I hardly see many differences (but JAVA looks simplier to me)

9. ### AbsaneRocket SurgeonValued Senior Member

Messages:
8,989
I was just relating my experiences with programming so that I may be able to lend any help if you need any. Honestly, I don't really care all that much about computers or programming anymore so my knowledge is slowly seeping away. Grab hold of what you can, I guess.

Could you post an example of something you did in Java? I'm curious.

10. ### draqonBannedBanned

Messages:
35,006
I just started this class.

public class needle {
public static void main(String[] args) {
for (int i = 1; i <= 4; i++) {

for (int j = 1; j <= 4*3; j++) {
System.out.print(" ");
}

for (int k = 1; k <= 2; k++) {
System.out.print("|");
}

System.out.println();
}

for (int i = 5; i <= 8; i++) {

for (int j = 1; j <= (4*3)-2; j++) {
System.out.print(" ");
}

for (int k = 1; k <= 1; k++) {
System.out.print("_/");
}

for (int h = 1; h <= 2; h++) {
System.out.print("|");
}

for (int l = 1; l <= 1; l++) {
System.out.print("\\_");
}

System.out.println();
}

}
}

11. ### draqonBannedBanned

Messages:
35,006
Absane...what are you trying to see by me posting an example? how extremely simple the code is?

I just started this class. k. no need to tell me that you did this stuff in kindergarden...

12. ### StryderKeeper of "good" ideas.Valued Senior Member

Messages:
13,102
Most programming languages do have striking similarities.

When programmers wrote their own flavours of language, they kept specified standards between the languages they were use to (Those things that appear logical in programming or are so pure in simplicity there was no point trying to rewrite them). In Java's case that would have been C originally (I believe the first Java compiler was probably programmed in C, If it was a paper I would of course go looking for sources to disprove my theory.), although it's had many years to "evolve".

13. ### draqonBannedBanned

Messages:
35,006
absane...say something.

14. ### AbsaneRocket SurgeonValued Senior Member

Messages:
8,989
Assembly and, *gasp*, machine code look nothing like Visual Basic

I had a friend once write his own programming language using C++. Actually, it was more like a script since he didn't have the knowledge to convert it all to machine code.

It gets me asking myself: why do we need so many different languages to do basically the same thing? Why have C++ and Java when we can just use C++? I'm sure that it's because Java has more specialization than C++ and it was a solution to the problem of how we can run the same program on different platforms without having to recompile.

Thank you for your calm and rational response...

Easily offended, eh? I didn't know you "just started this class." I'm sorry that I EVER showed interest in YOUR programming. Next time, I'll just Google some code since you obviously take offense to my taking interest in what you wrote.

15. ### draqonBannedBanned

Messages:
35,006
Java can be run on any machine, its much easier to change to assembly language than C++, C++ needs a linker...

16. ### draqonBannedBanned

Messages:
35,006
oh come on...dont be like that. I seriously am on very low level on this programming JAVA thing, cause its chapter 2 of the book and all. So its only natural for me to get all heisty.

17. ### DNA100Registered Senior Member

Messages:
259
good thing you solved your problem.
you may also try net beans.you don't have to use the dos mode.

18. ### StryderKeeper of "good" ideas.Valued Senior Member

Messages:
13,102
True, but the basic premise of any programming project is Pseudocoding, pseudocode is not a language itself but just a way for a human to interpret the behaviour of the program and what it's try to accomplish which then allows for it to be programmed by near any language. In fact it's probably pseudocode and a persons individual markup's that gave way to different languages.

At the end of the day though it's all about application to the task at hand and the overall overheads. Especially when dealing with what language to use (It's the difference between programming in a language that people know, or having to increase the time period of a project for people to train in that language).

19. ### Blue_UKDrifting MindValued Senior Member

Messages:
1,447
OP describes a common gotcha for console programs not run from within a shell. The noobs at uni were all told to put something at the end of their program to prevent it from terminating. Something like 'press any key' input should do the trick.

20. ### StryderKeeper of "good" ideas.Valued Senior Member

Messages:
13,102

Proof of Blue's L33t Skills

21. ### XeliosWe're setting you adrift idiotRegistered Senior Member

Messages:
2,447
Yeah Blue, I used to put a readline in at the end of the program when I was too lazy to compile it from a command prompt, similar to cin.get() in C++.

Code:
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
in.readLine();
Program won't exit until you hit a key.

22. ### RickॐValued Senior Member

Messages:
3,336
Use Eclipse Ganymede, should you need any help in the setup, let me know.

Rick

23. ### RubiksMasterReal eyes realize real liesRegistered Senior Member

Messages:
1,646
Draqon, if you ever need help with your java (or any other programming), feel free to PM me. I'm a software developer.

IntelliJ all the way (it's not free though).