From the course: Java 8 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Java syntax and compilation - Java Tutorial
From the course: Java 8 Essential Training
Java syntax and compilation
- All Java code is defined in classes. Each source code file defines at least one Java class that has the file extension .java. You can create these text files in any text editor, although I'll be using IntelliJ IDEA for most of this course. The compiler, javac, compiles your text-based code into bytecode that can be interpreted by the jvm, and then the java command runs that code. Here's a classic Hello World application. The name of the class is Main, and so it's defined in a text file named Main.java. The first line is called the package declaration. Java classes are typically organized into packages. A package is a globally unique string that typically starts with your domain name in reverse domain order. So if my domain is david.com, I would start my package string with com.david to ensure globally unique identifiers. Then if there's more than one class named Main in an application, I can distinguish them using the package. Next is the class declaration. The keyword public means…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.