That's... A lot of posts.
Just look on the MCForums, or Mod Central when it has some tuts. TS, you want to help me make some?
Offline
gbear605 wrote:
maxskywalker wrote:
poopo wrote:
class hi {
public static void main(String args[]) {
System.out.println("I know a bit of Java");
}
}import javax.swing.JOptionPane;
class HiAndAppletTrouble {
public static void main(String args[]) {
JOptionPane.showMessageDialog(null, "Me too. I like these pop-up messages!");
JOptionPane.showMessageDialog(null, "I code in Notepad/TextEdit!");
JOptionPane.showMessageDialog(null, "But when I try to run applets, I get an error message saying something like 'error in method main: no method called main'. It's weird.");
System.out.println("Help is appreciated.");
}
}The class needs to be named the same thing as the file.
My version of that:
I make javatest.javaCode:
import javax.swing.JOptionPane; class javatest { public static void main(String args[]) { JOptionPane.showMessageDialog(null, "Me too. I like these pop-up messages!"); JOptionPane.showMessageDialog(null, "I code in Notepad/TextEdit!"); JOptionPane.showMessageDialog(null, "But when I try to run applets, I get an error message saying something like 'error in method main: no method called main'. It's weird."); System.out.println("Help is appreciated."); } }I navigate to the javatest.java file in terminal (console)
I run in terminal (console) to make the class file:Code:
javac javatest.javaThen I run in console to launch the program (you could also double click the .class on some OS's)
Code:
java javatest
import javax.swing.JOptionPane; class ThatsWhatIDo { public static void main(String args[]) { JOptionPane.showMessageDialog(null, "I know. I do. I've made a calculator that I use all the time."); JOptionPane.showMessageDialog(null, "But when I try to make an Applet, that's what it says when I run it."); } }
Applet.java:
import java.awt.*; import javax.swing.*; class Applet { public void Applet (Graphics g) { //I've also called it main super.paint(g); g.drawString("Hello World!", 25, 25); } }
And then in command line:
javac Applet.java java Applet
Offline
Harakou wrote:
ipodbiped wrote:
WindowsExplorer wrote:
Does JavaScript count?
Java. JavaScript. Its all the same to me.
Java and JavaScript are completely different languages. They share some syntax, but they're similar only in name.
In fact, JavaScript was originally called ECMAScript!
Offline
ipodbiped wrote:
Bump
You heard the man/girl/asexual-being! Bump!
Offline
I know some Java, but not enough to really make a full fledged game.
Offline
throughthefire wrote:
I know some Java, but not enough to really make a full fledged game.
Same here. I can ALMOST make a simple attack/magic/shield game, though (lacking random numbers, and I'm sure I've got an old thread about it somewhere in Python, try the keywords Python, Game, Simple Game in Python, etc).
Offline
maxskywalker wrote:
throughthefire wrote:
I know some Java, but not enough to really make a full fledged game.
Same here. I can ALMOST make a simple attack/magic/shield game, though (lacking random numbers, and I'm sure I've got an old thread about it somewhere in Python, try the keywords Python, Game, Simple Game in Python, etc).
You're looking for a random number generator in Java?
Offline
Harakou wrote:
WindowsExplorer wrote:
I, how do I put this eh, don't think we need this topic...
Why not? I don't see a ton of Java discussion on Misc, but there's nothing really wrong with this topic. Like other "official topics" for less-discussed subjects, it'll die if there's no interest, and if it doesn't die, then it has a purpose.
Harakou, can you move this to Advanced Topics?
Java is advanced, and is a programming language.
Offline
cocolover76 wrote:
Harakou wrote:
WindowsExplorer wrote:
I, how do I put this eh, don't think we need this topic...
Why not? I don't see a ton of Java discussion on Misc, but there's nothing really wrong with this topic. Like other "official topics" for less-discussed subjects, it'll die if there's no interest, and if it doesn't die, then it has a purpose.
Harakou, can you move this to Advanced Topics?
Java is advanced, and is a programming language.
But it's not related to Scratch, so it belongs in Misc. Most of the time, when someone posts something like this in Advanced, it gets closed.
Offline
Harakou wrote:
maxskywalker wrote:
throughthefire wrote:
I know some Java, but not enough to really make a full fledged game.
Same here. I can ALMOST make a simple attack/magic/shield game, though (lacking random numbers, and I'm sure I've got an old thread about it somewhere in Python, try the keywords Python, Game, Simple Game in Python, etc).
You're looking for a random number generator in Java?
Yeah. I don't really understand the random thing. I'm searching for a thenewboston random number tutorial. I couldn't figure out how to get user input until I found out about java.util.scanner either.
Offline
maxskywalker wrote:
Harakou wrote:
maxskywalker wrote:
Same here. I can ALMOST make a simple attack/magic/shield game, though (lacking random numbers, and I'm sure I've got an old thread about it somewhere in Python, try the keywords Python, Game, Simple Game in Python, etc).
You're looking for a random number generator in Java?
Yeah. I don't really understand the random thing. I'm searching for a thenewboston random number tutorial. I couldn't figure out how to get user input until I found out about java.util.scanner either.
Just use the Math.random() method (returns a double between 0 and 1) or the Random class from the java.util package.
For example, if you wanted to get a random integer from 1 to 10 from the Random class, you would use the nextInt() method, which returns an integer from 0 (inclusive) to the argument provided (exclusive):
import java.util.Random; public class Ponies{ public static void main(String args){ Random rand = new Random(); int myRand = rand.nextInt(10) + 1; } }
Remember, the Java Documentation is your friend!
Offline
Harakou wrote:
maxskywalker wrote:
Harakou wrote:
You're looking for a random number generator in Java?Yeah. I don't really understand the random thing. I'm searching for a thenewboston random number tutorial. I couldn't figure out how to get user input until I found out about java.util.scanner either.
Just use the Math.random() method (returns a double between 0 and 1) or the Random class from the java.util package.
For example, if you wanted to get a random integer from 1 to 10 from the Random class, you would use the nextInt() method, which returns an integer from 0 (inclusive) to the argument provided (exclusive):Code:
import java.util.Random; public class Ponies{ public static void main(String args){ Random rand = new Random(); int myRand = rand.nextInt(10) + 1; } }Remember, the Java Documentation is your friend!
Okay. Thanks, Harakou. Yet again you help me with my code. How many languages do you know, anyway, if you'll excuse a bit of off topic.
Offline
maxskywalker wrote:
Harakou wrote:
maxskywalker wrote:
Yeah. I don't really understand the random thing. I'm searching for a thenewboston random number tutorial. I couldn't figure out how to get user input until I found out about java.util.scanner either.
Just use the Math.random() method (returns a double between 0 and 1) or the Random class from the java.util package.
For example, if you wanted to get a random integer from 1 to 10 from the Random class, you would use the nextInt() method, which returns an integer from 0 (inclusive) to the argument provided (exclusive):Code:
import java.util.Random; public class Ponies{ public static void main(String args){ Random rand = new Random(); int myRand = rand.nextInt(10) + 1; } }Remember, the Java Documentation is your friend!
Okay. Thanks, Harakou. Yet again you help me with my code. How many languages do you know, anyway, if you'll excuse a bit of off topic.
No problem. I actually don't know that much in regards to variety of languages though: A couple dialects of BASIC, a bit of Python, some Batch, and Java.
Offline
I use Eclipse, what about you guys?
I also made a private mod for MC which adds 2 new items:
Redstonebutton
TNTreceiver
You made the TNT with a TNT block and a redstone torch on top and the button like a minecart using stone, redstone dust in the middle and a torch on top.
Whenever the button is pressed it gives out a signal to prime the TNT so you can put TNT in prime points of your building without loads of complicated wires leading everywhere, once I iron out the bugs and get some pictures for the items (the button is using a stick and the TNT is using the normal TNT) I'll make it all public.
Offline
Harakou wrote:
maxskywalker wrote:
Harakou wrote:
Just use the Math.random() method (returns a double between 0 and 1) or the Random class from the java.util package.
For example, if you wanted to get a random integer from 1 to 10 from the Random class, you would use the nextInt() method, which returns an integer from 0 (inclusive) to the argument provided (exclusive):Code:
import java.util.Random; public class Ponies{ public static void main(String args){ Random rand = new Random(); int myRand = rand.nextInt(10) + 1; } }Remember, the Java Documentation is your friend!
Okay. Thanks, Harakou. Yet again you help me with my code. How many languages do you know, anyway, if you'll excuse a bit of off topic.
No problem. I actually don't know that much in regards to variety of languages though: A couple dialects of BASIC, a bit of Python, some Batch, and Java.
Oh. And yet you've helped me immensely with two.
Offline
my-chemical-romance wrote:
I use Eclipse, what about you guys?
I also made a private mod for MC which adds 2 new items:
Redstonebutton
TNTreceiver
You made the TNT with a TNT block and a redstone torch on top and the button like a minecart using stone, redstone dust in the middle and a torch on top.
Whenever the button is pressed it gives out a signal to prime the TNT so you can put TNT in prime points of your building without loads of complicated wires leading everywhere, once I iron out the bugs and get some pictures for the items (the button is using a stick and the TNT is using the normal TNT) I'll make it all public.
Sounds cool! I'd love to see it.
And I use Eclipse as well, naturally.
maxskywalker wrote:
Harakou wrote:
maxskywalker wrote:
Okay. Thanks, Harakou. Yet again you help me with my code. How many languages do you know, anyway, if you'll excuse a bit of off topic.No problem. I actually don't know that much in regards to variety of languages though: A couple dialects of BASIC, a bit of Python, some Batch, and Java.
Oh. And yet you've helped me immensely with two.
I do my best. The important thing is knowing how the languages work. I'm taking a computer science course currently, and although we work in Java, the important part is understanding the concepts. Once you understand that, you can understand pretty much any language based around the same concepts and program with it within a relatively short amount of time.
Offline
my-chemical-romance wrote:
I use Eclipse, what about you guys?
I also made a private mod for MC which adds 2 new items:
Redstonebutton
TNTreceiver
You made the TNT with a TNT block and a redstone torch on top and the button like a minecart using stone, redstone dust in the middle and a torch on top.
Whenever the button is pressed it gives out a signal to prime the TNT so you can put TNT in prime points of your building without loads of complicated wires leading everywhere, once I iron out the bugs and get some pictures for the items (the button is using a stick and the TNT is using the normal TNT) I'll make it all public.
I use TextEdit. I never felt I needed an IDE/development environment.
Offline
maxskywalker wrote:
poopo wrote:
class hi {
public static void main(String args[]) {
System.out.println("I know a bit of Java");
}
}import javax.swing.JOptionPane;
class HiAndAppletTrouble {
public static void main(String args[]) {
JOptionPane.showMessageDialog(null, "Me too. I like these pop-up messages!");
JOptionPane.showMessageDialog(null, "I code in Notepad/TextEdit!");
JOptionPane.showMessageDialog(null, "But when I try to run applets, I get an error message saying something like 'error in method main: no method called main'. It's weird.");
System.out.println("Help is appreciated.");
}
}
You use Notepad/Textedit? An IDE would really help, especially in debugging and such. I recommend either Notepad++ or Eclipse (Notch himself programs using the latter).
Offline
I don't like Java...
Offline
throughthefire wrote:
maxskywalker wrote:
poopo wrote:
class hi {
public static void main(String args[]) {
System.out.println("I know a bit of Java");
}
}import javax.swing.JOptionPane;
class HiAndAppletTrouble {
public static void main(String args[]) {
JOptionPane.showMessageDialog(null, "Me too. I like these pop-up messages!");
JOptionPane.showMessageDialog(null, "I code in Notepad/TextEdit!");
JOptionPane.showMessageDialog(null, "But when I try to run applets, I get an error message saying something like 'error in method main: no method called main'. It's weird.");
System.out.println("Help is appreciated.");
}
}You use Notepad/Textedit? An IDE would really help, especially in debugging and such. I recommend either Notepad++ or Eclipse (Notch himself programs using the latter).
I don't know who Notch is. I really just don't feel the need. I type with accuracy, and when I get a bug, Terminal gives me a useful error message so that I can fix my program instantly. The only useful thing might be running applets more easily, but I really don't mind. I tried to download Eclipse once. It said my Mac didn't know how to open the installer.
Offline
maxskywalker wrote:
throughthefire wrote:
maxskywalker wrote:
import javax.swing.JOptionPane;
class HiAndAppletTrouble {
public static void main(String args[]) {
JOptionPane.showMessageDialog(null, "Me too. I like these pop-up messages!");
JOptionPane.showMessageDialog(null, "I code in Notepad/TextEdit!");
JOptionPane.showMessageDialog(null, "But when I try to run applets, I get an error message saying something like 'error in method main: no method called main'. It's weird.");
System.out.println("Help is appreciated.");
}
}You use Notepad/Textedit? An IDE would really help, especially in debugging and such. I recommend either Notepad++ or Eclipse (Notch himself programs using the latter).
I don't know who Notch is. I really just don't feel the need. I type with accuracy, and when I get a bug, Terminal gives me a useful error message so that I can fix my program instantly. The only useful thing might be running applets more easily, but I really don't mind. I tried to download Eclipse once. It said my Mac didn't know how to open the installer.
You probably downloaded the Windows installer then...
Offline
maxskywalker wrote:
I don't know who Notch is. I really just don't feel the need. I type with accuracy, and when I get a bug, Terminal gives me a useful error message so that I can fix my program instantly. The only useful thing might be running applets more easily, but I really don't mind. I tried to download Eclipse once. It said my Mac didn't know how to open the installer.
Even syntax highlighting is a reason to get an IDE.
Offline