Grind a little deeper: more Java, please!

Last time, we took in a little hit of Java, just to see if we liked the taste. We checked out the basics and got a sniff of what the Hello World under Java had to offer. I don't know about you, but I could go for another taste! So, if you're up for it, let's grind a bit deeper, get under the grounds, and get into more of what makes Java, Java. Recap In the last entry, we went through the basics and came out with a simple "Hello World" in the Java language: public class SayHello { public static void main(String[] args) { //I'm using println instead of print so we move to the next line after System.out.println("Hello World"); } } This solidified the mainstays of Java for us: The making of classes, object specification, class types, datatypes, one special function-return type, and the world Java navigates to log (or, in this case, print out) a simple phrase. All of this is very important. It's the java of Java, but having a cup of Joe is more than just the Joe. In true Java fashion, we need to take all parts into consideration. In coffee terms, the first question could be, "Now that I've made the coffee, how can I bring it to the table?" It's a simple and often overlooked question for most, and, if we're used to interpretive languages like JavaScript, it's the kind of question we'd tend to ignore altogether. It's a very important quandary, though, and one that Java keeps in mind with each creation. The answer, of course, is a cup. As Java goes, this "cup" is referred to as a compiler Compiling We've said previously that Java converts its code into a form called java bytecode so that any computer with a JVM can interpret and run it. To do this, we must take the natural java form and pour, or, in this case compile it for transport. Here with Java, we do the compiling manually from the command shell. To start, we, from the shell, call the Java compiler, give it the path to our class, or the classpath so the compiler can find it, and finish it all with a .java javac SayHello.java That simple (so far)! the javac command calls the java compiler, then we steer it where it needs to go. We should remember though, that the Java compiler needs a door to walk through. That door is a door we've already built in our previous Java code: the main function. The compiler will always begin its work in the main function of the class it is pointed towards (in our case, the SayHello class). The flow of code compiling in Java will flow like so: Conclusion Today, we've taken the juicy Java we created previously and given it a cozy compiled cup to rest in before it finds its new home wherever it goes. The versatility of Java takes attention to detail and flexibility that is optimized in its compilation program. Next, we'll move even further into the Java process and maybe even following it all the way to this new home and beyond. Stay tuned, and happy coding. Resources https://www.scaler.com/topics/how-to-compile-java-program/ https://www.oracle.com/java/technologies/compile.html https://www.codecademy.com/learn/learn-java

Mar 31, 2025 - 15:35
 0
Grind a little deeper: more Java, please!

Last time, we took in a little hit of Java, just to see if we liked the taste. We checked out the basics and got a sniff of what the Hello World under Java had to offer. I don't know about you, but I could go for another taste! So, if you're up for it, let's grind a bit deeper, get under the grounds, and get into more of what makes Java, Java.

Recap

In the last entry, we went through the basics and came out with a simple "Hello World" in the Java language:

public class SayHello {
  public static void main(String[] args) {
//I'm using println instead of print so we move to the next line after
    System.out.println("Hello World");
  }
}

This solidified the mainstays of Java for us: The making of classes, object specification, class types, datatypes, one special function-return type, and the world Java navigates to log (or, in this case, print out) a simple phrase. All of this is very important. It's the java of Java, but having a cup of Joe is more than just the Joe. In true Java fashion, we need to take all parts into consideration. In coffee terms, the first question could be, "Now that I've made the coffee, how can I bring it to the table?" It's a simple and often overlooked question for most, and, if we're used to interpretive languages like JavaScript, it's the kind of question we'd tend to ignore altogether. It's a very important quandary, though, and one that Java keeps in mind with each creation. The answer, of course, is a cup. As Java goes, this "cup" is referred to as a compiler

Compiling

We've said previously that Java converts its code into a form called java bytecode so that any computer with a JVM can interpret and run it. To do this, we must take the natural java form and pour, or, in this case compile it for transport. Here with Java, we do the compiling manually from the command shell. To start, we, from the shell, call the Java compiler, give it the path to our class, or the classpath so the compiler can find it, and finish it all with a .java

javac SayHello.java

That simple (so far)! the javac command calls the java compiler, then we steer it where it needs to go. We should remember though, that the Java compiler needs a door to walk through. That door is a door we've already built in our previous Java code: the main function. The compiler will always begin its work in the main function of the class it is pointed towards (in our case, the SayHello class). The flow of code compiling in Java will flow like so:

Image description

Conclusion

Today, we've taken the juicy Java we created previously and given it a cozy compiled cup to rest in before it finds its new home wherever it goes. The versatility of Java takes attention to detail and flexibility that is optimized in its compilation program. Next, we'll move even further into the Java process and maybe even following it all the way to this new home and beyond. Stay tuned, and happy coding.

Resources