java programm,

Posts 1–12 of 12 · Page 1 of 1
java programm,
so, i readed some shit about java and i understand a bit, but i want to know how good i think i know about java so, could some1 give me a little nuby tutorial about how to make a programm in java


thanx,
What do you want to make? Hello world? Give me an idea and I can prbly explain it too you.
something little more difficult than hello world, just some aplication that is usefull for me
something like a .. i dont really know XD

, somehting like a chat.chat box or something?
something like msn that other ppl can join or somehting?
I think that would require a sever or something. Though I suppose you could code a servlet in Java, but you still need to designate a computer to host the traffic.

Maybe something simpler. Tell me what do you know so far and I can come up with something fun I think.
ok, like the hello world? nooby tutorial step by step if thats not to much for you XD
Quote Originally Posted by martijno0o0 View Post
ok, like the hello world? nooby tutorial step by step if thats not to much for you XD
Ok. Here's a fun lil starting program. You'll have to forgive me for the lack of flare, but Im a lil rusty when it comes to Java, but I need to get back up to speed if I want to program Android. Anyway lets get started.

Lesson: 1

[php]
import javax.swing.JOptionPane; //we are importing the JOptionPane that will make the pretty window for us.

public class HelloName //the name of our class. Unlike C++ everything is a class. A class can be run directly only if it has a main method.
{

public static void main(String[] args) //the main method for all Java programs
{
//
JOptionPane.showMessageDialog(null, "Hello, World"); // the method showMessageDialog() is a static method called from the class JOptionPane
String name = JOptionPane.showInputDialog("what is your name?"); will save your answer into the String name.
JOptionPane.showMessageDialog(null, "Hello " + name);//Now we use String name to greet the user.
System.exit(0); //return 1; in C++ Basically we exit the program. And return control to the system.
}
}

[/php]

This a fun little Hello world program. You enter your name and it greets you.
I commented the code to explain what I can, but feel free to ask questions.

Now since I pretty much gave you the code you should do something with it to be sure you understand it. I want you to create a program that will ask for a persons name and age and then greet the person with both.

EDIT: Oh yeah one more thing... man its been a while since I've done java. I'm a little out of it. Anyway was gonna say that System.exit(0); really isn't needed since Java automatically handles that usually, but you can put it anyway. You can also just put return; too... it doesn't matter in this case.
so i think;

i copy&past this(lol) to notepad and i save as helloworld.java and than?>>>?
XD this is just a try for me to go realy studiing on java
Quote Originally Posted by martijno0o0 View Post
so i think;

i copy&past this(lol) to notepad and i save as helloworld.java and than?>>>?
XD this is just a try for me to go realy studiing on java
Notepad?
Well I would get urself a Java IDE. Unless ur good at cmd line which im not.

I think "java projectfoldername.class" will compile it, but idk. I suk @ command Im prbly 90% wrong, and you would still need to set the classpath.

Just get a compiler like BlueJ or Eclipse.
not quite sure too but i think that the "exec" to compile is javac "javac blabla"

edit: ups didnt see that it was 2 days old xD sry
Quote Originally Posted by 'Bruno View Post
not quite sure too but i think that the "exec" to compile is javac "javac blabla"

edit: ups didnt see that it was 2 days old xD sry
oh yeh ur right. I was thinking of running a .class file. thx
lol how i run the .class?
Quote Originally Posted by martijno0o0 View Post
lol how i run the .class?
You need to change the directory to wherever you saved your class file and then run it by using the keyword "java" and your class name

See here:

I ran a HexEditor this way.

if you need any more help refer to this attachement. Also if you plan on doing any real work get an IDE.
RunJavaPrograms.rarattachment deleted · 1 downloads before removal
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us