Posts

Display MessageBox (Java Program)

Image
/** This application program displays Welcome to Java
 * in a message dialog box.
 */
import javax.swing.JOptionPane;
public class WelcomeInMessageDialogBox{
    public static void main(String[]args){
        //Display Welcome to Java! in a message dialog box
        JOptionPane.showMessageDialog(null, "Welcome to Java!", "Display Message", JOptionPane.INFORMATION_MESSAGE);
    }
}
Download Full Project

Open Notepad (Java Program)

Image
import java.util.*;
import java.io.*;

class OpenNotePad{
    public static void main(String[]args){
        Runtime rs = Runtime.getRuntime();

        try{
            rs.exec("notepad");
        }
        catch(IOException e){
            System.out.println(e);
        }
    }
}
Download Full Project

Display IP Address (Java Program)

Image
import java.net.InetAddress;

class IPAddress
{
    public static void main(String args[]) throws Exception
    {
        System.out.println(InetAddress.getLocalHost());
    }
}

Download Full Project