Java: Beginners Guide to Programming Code with Java Charlie Masterson
Table of Contents
Copyright 2017 by Charlie Masterson - All rights reserved. The following eBook is reproduced below with the goal of providing information that is as accurate and reliable as possible. Regardless, purchasing this eBook can be seen as consent to the fact that both the publisher and the author of this book are in no way experts on the topics discussed within and that any recommendations or suggestions that are made herein are for entertainment purposes only. Professionals should be consulted as needed prior to undertaking any of the action endorsed herein. This declaration is deemed fair and valid by both the American Bar Association and the Committee of Publishers Association and is legally binding throughout the United States. Furthermore, the transmission, duplication or reproduction of any of the following work including specific information will be considered an illegal act irrespective of if it is done electronically or in print.
This extends to creating a secondary or tertiary copy of the work or a recorded copy and is only allowed with express written consent from the Publisher. All additional right reserved. The information in the following pages is broadly considered to be a truthful and accurate account of facts and as such any inattention, use or misuse of the information in question by the reader will render any resulting actions solely under their purview. There are no scenarios in which the publisher or the original author of this work can be in any fashion deemed liable for any hardship or damages that may befall them after undertaking information described herein. Additionally, the information in the following pages is intended only for informational purposes and should thus be thought of as universal. As befitting its nature, it is presented without assurance regarding its prolonged validity or interim quality.
Trademarks that are mentioned are done without written consent and can in no way be considered an endorsement from the trademark holder.
C ongratulations on downloading Java: Beginners Guide to Programming Code with Java and thanks for doing so. The following chapters will discuss what Java is and what it is used for. By the end of this book, you should be able to use Java as you would any other programming language. Keep in mind that Java is not going to be the same as JavaScript. They are two completely different languages.
There are plenty of books on this subject on the market, thanks again for choosing this one! Every effort was made to ensure it is full of as much useful information as possible, please enjoy!
Java T he hardest thing about starting with Java is ensuring that you have everything installed that you are going to use with Java. Before you are able to write code, you have to have all of these programs or else you are going to set yourself up for a headache. Virtual machine The Java platform is going to be independent from any other program. So, it is going to be able to run on any operating system that you may be working with. It can work on any system thanks to the Java Virtual Machine. This machine is going to help in programming so that your code is processed correctly.
The virtual machine program has to be installed before any Java code can be run. A company called Oracle owns Java and on their website you are going to find the download link for the virtual machine which is also known as the Java Runtime Environment or JRE. When you check to see if your computer already has JRE, you can click on the link on the Oracle page that says Do I have Java? This link can be located under the download button that is on the top of the page. When this link is clicked, the computer is going to be scanned and then you are going to get your result for if you have it or not. If you do not, then you will have the chance to download it from this page. Once the virtual machine has been downloaded, you need to restart your system so that the program can run properly.
Software development kit Now that the software has been installed, Java is going to be able to run on your computer. But, before you can write code, you will need to install the Software development kit off of the Oracle website as well. This kit is known as the standard edition, and the one that you are going to want to use is known as NetBeans. The download will be rather large, but once it has been downloaded, you are going to be able to write Java code. How things work with Java The code for Java will be written in a text editor and the code is known as source code. the Javac program has the ability to turn any source code that you write into Java Byte Code which is known as compiling. the Javac program has the ability to turn any source code that you write into Java Byte Code which is known as compiling.
Once the file has been compiled, a new file is going to be created with a new extension of .class. At the point in time that the class file is created, the virtual machine is going to be able to run the file. NetBeans is a program that will handle the creation and compiling of files for you. But, looking behind the curtain, you are going to notice that your source code will be created into a Java file which will then launch Javac to create your class file. NetBeans has the capacity to run the program with its own software so that you are saved the hassle of opening up different windows when you are entering commands. NetBeans When first entering NetBeans you are going to have to wait for a minute because this program is not that fast.
But, when you finally get it loaded, you are going to go to file and then new project so that you can create a new application. After you have clicked on Java Application, you are going to click the next button to go on to the next section. Obviously you are going to need to name your project which is going to change the text at the bottom of the window so that it matches what you have named your project. A class is going to be created with your files name. If you name it as firstproject.FirstProject. the class is going to capitalize the F and P while the package is going to be lowercased.
NetBeans automatically defaults the save, but you can change it if you are going to be able to find it elsewhere better. A folder is also going to be created that will contain your projects name. Once you click the finish button, you are going to have all the files that you need created. After you have been returned to the IDE you are going to be able to look at your projects to see if there are any projects that you are working on. When you hit the plus symbol that is located next to the project name, you are going to see all the folders that are associated with that project. Each folder is going to expand further so that you can see the file where your source code is stored.
Next page