Chapter 13
Ten Techniques for Easier Java Coding
IN THIS CHAPTER
Compiling and running Java programs from the command line
Getting input from the user
Learning more Java operators
Comparing strings, nesting loops, and more
Java is a huge, sprawling language, and we've tried to do it justice in the previous chapters. But to really offer a complete look at Java would result in a book ten times this size, and who has the time or the patience to wade through such a tome? The goal of this book is to just give you the essentials of Java, and now we're tantalizingly close to achieving that goal. All that's left is to take you through a few techniques that will make your Java coding sessions easier and your Java programs more efficient.
Compiling a Java Program from the Command Line
You can compile a program from a command prompt by using the javac command. Before you can do that, however, you need a program to compile. Follow these steps:
- Using any text editor (Notepad will do), type the following text in a file, and save it as
HelloApp.java:public class HelloApp{ public static void ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access