Java for Complete Beginners
Step By Step with Full Explanation for Java Beginners
MOHAMMED ABDELMONIEM
Java for Complete Beginners
Step By Step with Full Explanation for Java Beginners
Copyright Mohammed Abdelmoniem Kamel, 2019
All right reserved. No part of this publication may be reproduced, stored or introduced into a retrieval system, or transmitted, in an form or by any means (electronic or mechanical form), including photocopy, recording, or otherwise, without the prior written permission by the copyright owner.
DISCLAIMER
The information in this book is distributed on an As Is basis, without warranty. While every precaution has been taken in the preparation of the book, neither the authors nor the publisher , shall have any liability to any person or entity with respect to any loss or damage or alleged to be caused directly or indirectly by the instructions contained in the book or the computer software and hardware products described in it.
TRADEMARKS
Many of the designation used by manufacturing and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, the designation appear as requested by the owner of the trademark. All other product names and services identified throughout this book are used in editorial fashion only and for the benefit of such companies with no intention of infringement of the trademark. No such use, or the use of any trade name, is intended to convey endorsement or other affiliation with this book.
Preface
Java is one of the preferred languages among developers, used in everything right from games, supercomputers to even home appliances. This book on Java programming aims to instill the reader with an understanding of the object-oriented approach to programming and aims to develop some practical skills along the way. The concepts that will be explained and skills developed are in common use among programmers using many modern object-oriented languages and are thus transferable from one language to another. However, for a practical purpose, these concepts are explored and demonstrated using the Java programming language.
The Java programming language is used to highlight and demonstrate the application of fundamental objects (inc. the use of loops, selection statements, performing calculation, arrays, data types and a basic understanding of file handling), as well as basic concepts of JavaFX.
This book has a practical purpose so that the primary goal is to show how to. Of course, there is also a more theoretical explanation, but I have tried to minimize the theoretical material in order to quickly reach what you need to write a program. Most of the material is presented through a large number of examples and the explanations, which are associated therewith.
This book is an introduction to programming and the language Java. It requires no special assumptions of the reader and is aimed at anyone who wants or needs to learn about programming. It is thus not a prerequisite that the reader has knowledge of programming, but only that the reader is interested in programming and would have IntelliJ IDEA installed on his computer.
When you finish this book, youll be comfortable with the basics of Java language and will be able to start using them in your day-to-day Java programming work.
Mohammed Abdelmoniem Kamel
2019
ata4tech@gmail.com
About The Author
Im Mohammed Abdelmoniem. Im a web developer who design, currently living in Omdurman, Sudan. I have a Bachelor of Science in Computer Science, and an MBA degree in Information Technology. My primary focus and inspiration about creating beautiful and useful products. Im constantly experimenting with new technologies and techniques. I am very passionate about Web development, and strive to better myself as a developer, and the development community as a whole.
Code Samples
The sample programs shown in the pages of this book were compiled with IntelliJ IDEA 2019 and JDK 8/9/10. You can download the source code from the below link:
Ill try to keep the code updated with the latest release of JDK and to fix (and comment) any errors that might have sneaked through.
You can report problems, bugs, or other kinds of feedback about the book or source code by sending it on my email: ata4tech@gmail.com.
Table of Contents
Part 1 : Java Fundamentals
You dont have to be great to start. But you have to start to be great. - Zig Zigla
Chapter 1
Introduction to Java
Hardware and Software Concepts
Hardware and Software Concepts
A computer is an electronic device that takes input, processes it, and converts it into meaningful information. All input is called data, and all output is called information.
Figure 1.1 | Computer System
The table below describes the difference between the data and information.
Table 1.1 | Difference between data and information
Data | Information |
Data is used as input for the computer system. | Information is the output data. |
Data is unprocessed figures. | Information is processed data. |
Data doesnt depend on information. | Information depends on data. |
Data doesnt carry a meanings. | Information must carry a logical meanings. |
Data is the raw material. | Information is the product. |
Example: 200, B, Sudan | Example: Freds blood pressure readings |
So, data usually refers to raw data, or unprocessed data. It may be in the form of numbers, letters, or a set of characters. And once the data is analyzed, it is considered as information. Information is a sequence of symbols that can be interpreted as a message. It provides knowledge or insight about a certain matter.
Figure 1.2 | Data and Information
Therefore a computer can now be defined as a fast and accurate data processing system that accepts data, performs various operations on the data, has the capability to store the data and produce the results on the basis of detailed step by step instructions given to it. The terms hardware and software are almost always used in connection with the computer.
Computer hardware
Hardware refers to the physical components that a computer is made of. For example, chips, boxes, wires, keyboards, speakers, disks, cables, mice, monitors, and so on.
The major hardware components
Figure 1.3 | The Major Hardware Components