Helpful Information
 
 
Category: Java
Writing In Java

Hello all:),

I am a complete begginner to java and don't know the first thing about it ...
If I wanted to write Hello Juice Bomber in a java program how would i do it/what's the code???

Thanks:)

What sort of a Java program?

To write it to the console,
class Hello {
public static void main(String[] argv) {
System.out.println("Hello Juice Bomber");
}
}Or with a Swing GUI:
import java.swing.JFrame;
import java.swing.JLabel;
import java.swing.JPanel;

class Hello extends JFrame {
public Hello() {
super("Hello");
setSize(150, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
((JPanel)getContentPane()).add(new JLabel("Hello Juice Bomber"));
setVisible(true);
}

public static void main(String[] argv) {
new Hello();
}
}Or as an applet:
import java.swing.JApplet;
import java.swing.JLabel;
import java.swing.JPanel;

class Hello extends JApplet {
public void start() {
((JPanel)getContentPane()).add(new JLabel("Hello Juice Bomber"));
}
}

class Simple
{
public static void method()
{
System.out.println("Hello Juice Bomber");
}
public static void main(String Str[])
{
Simple.method();
}
}

Um... that's nice? :p










privacy (GDPR)