= Programming in Java Please choose a learning level that corresponds to your experience in Java or another programming language (or lack thereof). If you have never programmed before, see [#first_lang Java as Your First Language]. If you have programmed using high-syntax programming language with object-orientation such as C++ (using OOP), see [#second_lang_advanced Java as Your Second Language From a High-Syntax, Object-Oriented Language]. If you have programmed before, but using a simpler, abstracted language, such as Go or Python without classes, without object-orientation, see [#second_lang_simp Java as Your Second Language From a Low-Syntax, Abstracted Language w/o Object-Orientation]. If you have already learned the basics of Java, see [#java Advanced Java After Having Already Learned Java Syntax & Control Structures]. If you think you are a master in Java and computer science in general, try [#superjava Incredibly Advanced Java Structures, Techniques, and Design]. If you think you are the absolute best programmer in the world, try again. == [=#first_lang]Java as Your First (Programming) Language === Introduction to Computer Hardware For those of you starting out in the programming world, a brief description of the hardware of a computational machine is necessary. See [wiki:JavaLanguageArchitecture here] to read about the JVM and how Java compiles. == Java as Your Second (Programming) Language === [=#second_lang_advanced]From a High-Syntax, Object-Oriented Language === [=#second_lang_simp]From a Low-Syntax, Abstracted Language w/o Learning Object-Orientation == [=#java]Advanced Java After Having Already Learned Java Syntax & Control Structures If you have already learned object oriented concepts, skip to the [#next next section]. === Object-Oriented Programming Concepts These sections assume that you have read through the [wiki:IntroductionOOP Introduction to Object-Oriented Programming] page. ==== Encapsulation Encapsulation is the idea that a class contains both fields (variables and constants), which show state, and methods, which dictate the functionality. Encapsulation also makes clear the idea that methods and fields are tightly bound to the object that they represent, and should be implemented as such. Nearly all fields should be assumed to be private unless there is a very good reason to make them otherwise. Methods are either generally public or private, depending on the use. Assume that the client would like it to be as easy as possible for them, so provide functionality that is complex enough to be useful, but also not so complicated to use and understand. ==== Inheritance Oftentimes, classes will reuse code from another class and build on it. For example, there might a generic {{{Car}}} class, which several others might ''subclass'' and create additional functionality in their classes, which might be {{{Porsche}}} and {{{Mustang}}}. ==== Polymorphism === [=#next]The Ternary Operator When assigning a value to a variable, sometimes, if the value being assigned is subject to a condition, the ternary operator will simplify code, save space, and enhance comprehension, but only when used properly. The operator transforms this: {{{ #!java int integer; if (newIntegerWanted()) integer = randomInteger(); else integer = 0; }}} to: {{{ #!java int integer = newIntegerWanted() ? randomInteger() : 0; }}} === Abstract Classes ==== Choosing between an abstract class, an interface, or standard inheritance == [=#superjava]Super Advanced Java Structures, Techniques, & Design