No, not easily. Word processors such as Word create files that compilers cannot use. (Actually, they can be forced to do this, but it is not worth the effort.)
Here 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.
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] +"!" );
}
}
}
Here is an outline of how to 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 HelloPlanetsWill this work for Windows 95?