This java program opens notepad by
Runtime class. Notepad is an application comes with Windows operating
system. Notepad is text editor. In this program, we create an object of Runtime
class and calling exec() method by passing parameter as application name.
Java Program to Open Notepad
import java.util.*;
import java.io.*;
class OpenNotepad {
public static void main(String[] args) {
System.out.println("Opening Notepad...");
Runtime rt = Runtime.getRuntime();
try {
rt.exec("notepad");
}
catch (IOException e) {
System.out.println(e);
}
}
}
Output:
Opening Notepad...
Notepad |
0 comments:
Post a Comment