My First In Java
()
About this ebook
Concepts are discussed chapter by chapter in progressive order. It is suggested that student answers chapter exercises to gauge the understanding of the topics discussed.
Students may download all sample programs with the provided link.
YouTube video links were also provided if one opts to learn the topics through video presentations.
Object-oriented programming(OOP) is not yet discussed on this book. Though java is an OOP language, the author believes OOP concepts are too broad or too early to discuss for students who are just starting to learn programming.
Related to My First In Java
Related ebooks
Learn Java Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsJava: Beginner's Guide to Programming Code with Java Rating: 0 out of 5 stars0 ratingsGetting Inside Java - Beginners Guide: Programming with Java by Prem Kumar Rating: 0 out of 5 stars0 ratingsLearn Java for Android Development: Java 8 and Android 5 Edition Rating: 0 out of 5 stars0 ratingsJAVA: Java Programming for beginners teaching you basic to advanced JAVA programming skills! Rating: 0 out of 5 stars0 ratingsJava: Beginner's Guide to Programming Code with Java: Java Computer Programming Rating: 0 out of 5 stars0 ratingsCore Java Interview Questions You'll Most Likely Be Asked: Job Interview Questions Series Rating: 4 out of 5 stars4/5Programming Constructs in Java Rating: 1 out of 5 stars1/5Learn Java: A Crash Course Guide to Learn Java in 1 Week Rating: 3 out of 5 stars3/5Java Programming Rating: 0 out of 5 stars0 ratingsJava and Java EE Interview Preparations Rating: 0 out of 5 stars0 ratingsIntroduction to Java Programming, 2nd Edition Rating: 5 out of 5 stars5/5JAVA Programming for Beginners: The Simple Guide to Learning JAVA Programming fast! Rating: 0 out of 5 stars0 ratingsJAVA for Beginner's Crash Course: Java for Beginners Guide to Program Java, jQuery, & Java Programming Rating: 4 out of 5 stars4/5100+ Solutions in Java Rating: 0 out of 5 stars0 ratingsProgramming Essentials Rating: 5 out of 5 stars5/5Beginning Mobile Application Development in the Cloud Rating: 0 out of 5 stars0 ratings(Part 1) Absolute Beginner: Java 4 Selenium WebDriver: Come Learn How To Program For Automation Testing Rating: 5 out of 5 stars5/5JAVA Programming Simplified: From Novice to Professional - Start at the Beginning and Learn the World of Java Rating: 0 out of 5 stars0 ratingsPrinciples of Programming: Java Level 1 Rating: 0 out of 5 stars0 ratingsSelenium Webdriver: Book1 Rating: 2 out of 5 stars2/5IOS Programming For Beginners: The Simple Guide to Learning IOS Programming Fast! Rating: 0 out of 5 stars0 ratingsSelenium with Java – A Beginner’s Guide: Web Browser Automation for Testing using Selenium with Java Rating: 0 out of 5 stars0 ratingsComputer Programming Languages for Beginners Rating: 0 out of 5 stars0 ratingsJava for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5Hello World: Student to Software Professional - a Transformation Guide Rating: 0 out of 5 stars0 ratingsJasmine JavaScript Testing - Second Edition Rating: 0 out of 5 stars0 ratings
Computers For You
Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5Network+ Study Guide & Practice Exams Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsThe ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 0 out of 5 stars0 ratings101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5AP Computer Science Principles Premium, 2024: 6 Practice Tests + Comprehensive Review + Online Practice Rating: 0 out of 5 stars0 ratingsCompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsChildhood Unplugged: Practical Advice to Get Kids Off Screens and Find Balance Rating: 0 out of 5 stars0 ratingsChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsPractical Lock Picking: A Physical Penetration Tester's Training Guide Rating: 5 out of 5 stars5/5Elon Musk Rating: 4 out of 5 stars4/5Dark Aeon: Transhumanism and the War Against Humanity Rating: 5 out of 5 stars5/5The Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Master Builder Roblox: The Essential Guide Rating: 4 out of 5 stars4/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5
Reviews for My First In Java
0 ratings0 reviews
Book preview
My First In Java - Jeremias Esperanza
potential.
Chapter 1
An Introduction to Java
At the end of this chapter, you will be able to:
Know history that drove development of java;
Specify the developement stages of a java program;
Realize the importance of an IDE;
Install java compiler;
Install Eclipse IDE.
Java is a high-level programming language. High-level language means a program can be written in a human language that the computer machine can later on decipher and understand.
James Gosling and associates at Sun Microsystems, during the 1990s, started developing a programming language (PL) that will suit automation of household appliances (TV, VCRs, Refs, etc..). Oak was the original name they could think of for the PL only to realize there was already an existing name for that PL. The name Java was later on derived from a flavor of a coffee when they were sipping it from a coffee shop during those times.
The popularity of Java grew tremendously during the mid-1990s. It was also on those times internet is paving its way to mainstream computing. The timing of Java was perfect because applications can be developed using the PL without concerns on which platforms it will run. Soon the defacto language of choice of most software development companies is Java up to the present time. It is estimated that Java runs on 5.5 billion devices worldwide today.
Phases of a Java program
Java boasts its strengths in terms of portability. Once you write and compile, it will run on any platform a computer has. Platform means is the operating system used by a machine. Example of this is Windows, Linux, MacOS, Android, and many others.
How do we develop program in Java? The following are stages:
1. Write. A java program can be written in any text editor softwares such as MS Word (without the format codes), Notepad, Crimson Editor, Sidekick, etc. What you need is to supply a file extension name .java once you save the file. The file you have just saved will be the source code of a java program.
2. Compile. You can easily download for free from the internet the latest java development kit (JDK) that you may use in developing java programs. Together with the JDK is a program called javac.exe. This is the compiler of java.
What does a compiler do? Compiler checks the syntax or formats of the codes you have written on a java program. It will ensure that all the words you have written comply with the java statement commands. If errors are detected from your program, it will specify the line number on where the mistake/s took place. You need to correct those errors, and re-compile. You will only proceed on the next stage of the development if your program is error-free.
C1.StagesFigure C1.1 Phases of Java program
An error-free program compiled by the javac.exe produces a byte code file. Byte code is a machine-language codes that will be interpreted by a Java Virtual Machine (JVM). The codes are no longer expressed in a human language but with the codes the machine understands. Byte code file has an extension filename of .class. An example on how to compile a program in a command line is as follows (Hello is the name of the program):
javac Hello.java
3. Run. Along with the downloads of JDK is an interpreter called java.exe. An interpreter is used to serve as an interface so the processor of the machine can understand what your program wants to achieve once you run it. Please note that the byte code file (filename with the .class extension) is the one interpreted and not the original file you have written (filename with the .java extension). Below is an example on how to run a java byte code program on a command line:
java Hello
Role of IDE
Integrated Development Environment (IDE) is a software tool that will increase the development of a java program. You do not need to have an IDE to develop a java program. You need a text editor program, compiler, and interpreter to develop program.
Detection of errors are made earlier even the program is not yet compiled when you use an IDE. The IDE notifies a syntax error occurs in the command/statement or no declaration yet has made on a variable as the programmer types the program. It even suggests solutions on how to quick fix an error in the program. It also gives a hint on what available methods and parameters you could use for a particular command/statement.
The interface with the java compiler and interpreter is already done by an IDE. Running your program can easily be done with a push of a command button. It also includes a debugger on where you could trace the values of the variables. An IDE is a java solution tool rolled into one.
There are many popular IDEs available on where you could download for free. Examples of IDEs are Eclipse, Net Beans, among others.
Before we could write our first java programs, we need to install our java compiler that will convert our source program into an bytecode file that a machine can understand.
An Integrated Development Environment (IDE) is a software tool used by developers in writing, compiling, debugging, and running their programs. This is where Eclipse IDE is known for.
The following installation will guide us on how to download and install java compiler and Eclipse IDE on our computer.
Installing Java Compiler for Windows
Go to your browser.
Visit http://google.com
Type in the google search box: java jdk.
Click Java SE Downloads
C1.1Figure C1.2 Java sites to download compiler
5. Click the latest release. On this case it is the Java Platform (JDK) 7u6. (see Figure C1.3).
C1.2Figure C1.3 Java Development Kit to download
6. Click the Accept License Agreement.
C1.3Figure C1.4 Accept License Agreement
7. Underneath select the appropriate java compiler suited for your OS. On this case, we choose Windows X86 for the 16-bit Windows 7 OS.
C1.4Figure C1.5 Version to download
8. Wait for the download to complete. Double click the downloaded file (see Figure C1.6).
C1.5Figure C1.6 Version downloaded
9. On Windows 7 you will be prompted if the installer is allowed to make changes. Just click yes.
10. You will be prompted on the installation procedure. Accept the default settings. Just click Next.
C1.6Figure C1.7 Opening window prior to installation
C1.7Figure C1.8 Folder location on where to install
11. This is the last window when the installation is completed. Click Finish.
C1.8Figure C1.9 Final window after installation
Video presentation: Install compiler
Installing Eclipse IDE
1. Visit http://www.eclipse.org/downloads/
C1.9Figure C1.10 Choices of eclipse version
2. Depending on your computer OS, click the corresponding link (normally, XP is Windows 32 bit, Windows 7 is 32 or 64 bit). On my case, I’m using Windows 7, I will click Eclipse Classic 3.7.2 Windows 32 bit. Skip 3 if you are running under Windows OS.
3. If you are running a different OS (Linux or Mac OS), you may select it on the dropdown box. Just the same, click the bit version your OS supports.
C1.10Figure C1.11 Choose appropriate OS
4. You will be prompted to select the mirror location where downloads will come from. Click the suggested default site (green down arrow). Depending on the speed of your modem, this may take a while. Wait for the download to complete.
C1.11Figure C1.12 Mirror site of download
5. Double click the zip file to begin extraction of eclipse.
C1.12Figure C1.13 Eclipse downloaded installer
6. Click the Extract To commence.
C1.13Figure C1.14 WinRAR extraction of eclipse
7. Select (C:) Local Disk as the destination of our extraction. Click OK.
C1.14Figure C1.15 Folder location on where to install eclipse
8. After completing the extraction of the file, close the Winzip program.
9. Click. Start | My Computer
10. Double click (C:) Local Disk.
11. Double Click the Eclipse folder.
12. Right-click the Eclipse icon and Send To | Desktop to create a shortcut.
C1.15Figure C1.16 Shortcut icon for eclipse
Video presentation: Install Eclipse IDE
Chapter 2
Java First Programs
At the end of this chapter, you will be able to:
Write your first sets of java programs;
Familiarize with the terminator symbol semicolon;
Use comments, new line and tab characters;