No, not easily. Word processors such as Word create files that compilers cannot use. (Actually, Word can be forced to create a suitable file, but it is not worth the effort.)
class HelloPlanets
{
public static void main ( String[] args )
{
String[] planets = {"Mercury", "Venus", "Earth", "Mars", "Jupiter",
"Saturn", "Uranus", "Neptune", "Pluto"};
for ( int j=0; j< planets.length; j++ )
{
System.out.println("Hello " + planets[j] +"!" );
}
}
}
Above is an example Java program. Just for fun, the program is different than the previous examples. The details won't be explained until later chapters.
Here is an outline of how to copy and run the program. You can try this now, or continue reading this chapter (which shows the method step-by-step).
HelloPlanets.java.
HelloPlanets.java is there.C:\Temp> javac HelloPlanets.javaC:\Temp> java HelloPlanetsHow do you start Notepad?