JAVA PROGRAMMING
Your Step by Step Guide to
Easily Learn Java in 7 Days
iCode Academy
JAVA FOR BEGINNERS
Copyright 2017 by iCode Academy.
All rights reserved.
In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved.
The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly. Respective authors own all copyrights not held by the publisher.
Legal Notice:
This eBook is copyright protected. This is only for personal use. You cannot amend, distribute, sell, use, quote or paraphrase any part or the content within this eBook without the consent of the author or copyright owner. Legal action will be pursued if this is breached.
Disclaimer Notice:
Please note the information contained within this document is for educational and entertainment purposes only. Every attempt has been made to provide accurate, up to date and reliable complete information. No warranties of any kind are expressed or implied. Readers acknowledge that the author is not engaging in the rendering of legal, financial, medical or professional advice.
By reading this document, the reader agrees that under no circumstances are we responsible for any losses, direct or indirect, which are incurred as a result of the use of information contained within this document, including, but not limited to, errors, omissions, or inaccuracies.
I ntroduction ..........................................................................
Chapter 1: Basics of Java ..................................................
Chapter 2: Conditional Statements, Iterative Statements, and Branching Statements ................
Chapter 3: Arrays ................................................................
Chapter 4: Methods, Objects, Classes ...........................
Chapter 5: Interfaces and Inheritance ..........................
Chapter 6: Packages
Wrapping Up .........................................................................
Conclusion .............................................................................
Check Out The Other iCode Academy Books ..............
T he world of programming is a very diverse one where each programming language has its own specific advantages. There are languages such as C and Assembly which focus on operating system instructions and other computer software while there are other languages such as HTML and JavaScript which focus on web-based applications. An example of a programming language that can do both is Java. This eBook contains guides and instructions that will help you learn and understand java in one day.
So what is Java?
Java is actually a decent programming language developed at Sun Microsystems. It was originally used for Internet applications or applets. Those applets are embedded on web pages and run in the browser. Java uses a special format known as byte code instead of an ordinary machine code. With the help of a Java interpreter program, the byte code can be executed on any computer. This Java interpreter program is called a Java Virtual Machine or JVM. It is available today in most computer systems. Java may use byte code format but there is nothing about Java that requires this byte code technique. There are some compilers that exist and generate real machine code, or more commonly known as native code.
Java programs consist of sets of classes. The source files of those programs are written in .java. These source files are then compiled into .class files which contain the byte code instead of the CPU-specific machine code. The .class files are then executed by a Java Virtual Machine (JVM or interpreter) at run time.
Java is not limited to Internet applications. It is technically a complete general object-oriented programming language which can be used to develop all sorts of applications. The syntax of Java is very much similar to the syntax of C++ but removes its error-prone features and complications.
Do not mistake Java for JavaScript. JavaScript is an entirely different language. JavaScript is an interpreted programming language used as one of the three essential components of a webpage or website content production. The difference between Java and JavaScript is that Java is an object-oriented programming language while JavaScript is an object-oriented-scripting language. Codes written in Java need to be compiled while the codes written in JavaScript are all in text. Java creates applications that can run in both a virtual machine and a browser while JavaScript can only run on a browser. Each language also requires different sets of plug-ins.
Sun Microsystems, the company behind the creation of Java, offer free tools for developing Java-based software. If you want to know more about those tools, you can visit this website (https://www.java.sun.com) for more information such as Java compilers for different computer systems (UNIX, Microsoft Windows, OSX) along with detailed documentation. Java compilers are free and can be down-loaded from the given link.
Throughout the eBook, we will discuss the basics of how Java programs are compiled, simple expressions and declarations, classes, objects, and statements, until you are able to learn, understand, and write a complete Java program in just one day.
Chapter 1:
Basics of Java
C ompiling and running a Java Program
Every source file in Java contains exactly one class. The filename must be the same as the class name. For example, a class Hello should be stored in the source file Hello.java . Using the javac compiler, the source file Hello.java can be compiled in the terminal:
Next page