Loading...
Menu

Java For Beginners. Learn Java Fast.

[] Java For Beginners. Learn Java Fast.

[]

By George L.

Shakespir Edition

Copyright © 2017 by George L.

h1={color:#000;}.

h1={color:#000;}.

Shakespir Edition, License Notes

Thank you for downloading this ebook. You are welcome to share it with your friends. This book may be reproduced, copied and distributed for non-commercial purposes, provided the book remains in its complete original form. If you enjoyed this book, please return to your favorite ebook retailer to discover other works by this author. Thank you for your support.

h1<{color:#000;}.

h1<{color:#000;}.

h1<{color:#000;}.

h1<{color:#000;}.

h1<{color:#000;}.

h1<{color:#000;}.

h1<{color:#000;}.

Introduction

[ P.S. A FREE BONUS VIDEO COURSE is included in the end.*]

 

I want to thank you and congratulate you for downloading the book, “Java For Beginners. Learn Java Fast”.

This book will give you an overview of the main concepts of programming in the Java language.

Java is the programming language of choice for web developers and is used in Android applications, web sites, web-based gaming and web-based applications. It is one of the easiest languages to learn and I will be covering the fundamental concepts of Java programming.

Thanks again for downloading this book, I hope you enjoy it!

 

[]

[]

[]

[]

[] Chapter 1: Basic Java Syntax

 

Java is one of the most versatile of all the computer programming languages and one of the easiest to learn. In this chapter, we will be covering the basic syntax of the language, which is the first thing you must learn:

[] Whitespace

Whitespace characters are what makes the java code much easier to read and consist of spaces, newlines, and tabs. Usually, a whitespace character will be ignored by the Java compiler so, even if you were to use large amounts of it in your code, the actual bytecode that is generated would be quite small and would have an impact on system memory. Do be careful of excessive use, though, because it can make the code hard to read.

[] Styles

Styles is all about how the source code is formatted. A Java file is normally formatted so that it is easy to read and that is where style guidelines come into play. These are standards that are usually set by an individual or an organization; this formatting is ignored by the Java compiler and it includes the use of indentation, newlines, and spacing. You can also use comments to format the code and add in notes so that anyone else reading your code can see what is going on.

Styles must deal with the formatting of the source codes. Generally, we format a Java file so that it becomes easier to read. To format a Java file, we need to look at style guidelines. Style guidelines are mainly standards followed by company, organization or individual. Generally, when setting guidelines developers keep in mind formatting of code which is easier to read. This formatting is ignored by the compiler. Styles include the use of indentation, spacing, and newlines which format source codes as per developers. Comments are used to format code and add notes so that any other programmer reading the code gets the idea behind the code.

Example 1 – Bad Formatting

// Bad Style Coding

// Not easy to read, no indents used

public class Welcome {

public static void main(String[] args){

int i = 0; // single line comment

for(int i=0;i<=10;i++){

int j = 1;

int k = j;

System.out.println(“Welcome to comments”);

}

}

Example 2 – Good Formatting

// Good Style Coding

// Very easy to read, excellent use of indents

public class Welcome {

public static void main(String[] args){

int i = 0; // single line comment

for(int i=0;i<=10;i++){

int j = 1;

int k = j;

System.out.println(“Welcome to comments”);

}

}

}

[] Comments

Comments are very important because they allow you to add notes to your source code, thus making what could be a complicated piece of code much easier to read and to debug. They are not read by the Java compiler so they will have no impact on memory. There are a couple of types of comments:

*
p<{color:#000;}. Single line – begins with a // and anything written between // and the end of the line is ignored

*
p<{color:#000;}. Multi-line – begins with /* and ends with */ - anything written in between is ignored and this can cover many lines of your code.

public class Welcome {

public static void main(String[] args){

int i = 0; // this is a single line comment

for(int i=0;i<=10;i++){

/* int j = 1;

int k = j;

System.out.println("Welcome to comments"); */

/* multi-line comment, whole code in between will be commented out */

}

}

}

[] Identifiers

Identifiers are the collective names that are given to methods, classes and variables in Java. There are rules about the naming conventions for identifiers and these follow:

*
p<{color:#000;}. Identifiers must start with a Unicode character, underscore or dollar sign

*
p<{color:#000;}. Numbers can be included after the first character, along with dollar signs, underscores and Unicode characters

*
p<{color:#000;}. Try to avoid using currency symbols, like $ if you can

*
p<{color:#000;}. Identifier names are case sensitive

*
p<{color:#000;}. You cannot use a reserved keyword

*
p<{color:#000;}. Use capital letters to separate two or more words in the name

Valid Identifiers Invalid Identifiers Comments

tree Tree case-sensitive

my2var 2myVar digit as the first character

myNewVar my@new@var invalid character – @

switching switch a reserved keyword

[] Reserved Keywords

There are several words in Java that are reserved for use by the language and you cannot use them for anything other than their intended purpose, especially not for naming. The reserved keywords are:

*
p<{color:#000;}. abstract

*
p<{color:#000;}. assert

*
p<{color:#000;}. boolean

*
p<{color:#000;}. break

*
p<{color:#000;}. byte

*
p<{color:#000;}. case

*
p<{color:#000;}. catch

*
p<{color:#000;}. char

*
p<{color:#000;}. class

*
p<{color:#000;}. const

*
p<{color:#000;}. continue

*
p<{color:#000;}. default

*
p<{color:#000;}. do

*
p<{color:#000;}. double

*
p<{color:#000;}. else

*
p<{color:#000;}. enum

*
p<{color:#000;}. extends

*
p<{color:#000;}. final

*
p<{color:#000;}. finally

*
p<{color:#000;}. float

*
p<{color:#000;}. for

*
p<{color:#000;}. goto

*
p<{color:#000;}. if

*
p<{color:#000;}. implements

*
p<{color:#000;}. import

*
p<{color:#000;}. instanceof

*
p<{color:#000;}. int

*
p<{color:#000;}. interface

*
p<{color:#000;}. long

*
p<{color:#000;}. native

*
p<{color:#000;}. new

*
p<{color:#000;}. package

*
p<{color:#000;}. private

*
p<{color:#000;}. protected

*
p<{color:#000;}. public

*
p<{color:#000;}. return

*
p<{color:#000;}. short

*
p<{color:#000;}. static

*
p<{color:#000;}. strictfp

*
p<{color:#000;}. super

*
p<{color:#000;}. switch

*
p<{color:#000;}. synchronized

*
p<{color:#000;}. this

*
p<{color:#000;}. throw

*
p<{color:#000;}. throws

*
p<{color:#000;}. transient

*
p<{color:#000;}. try

*
p<{color:#000;}. void

*
p<{color:#000;}. volatile

*
p<{color:#000;}. while

[] Separators

These are used a lot in Java and each has its own use:

Separator Comments

() For declaring methods/passing arguments

{} Code block

[] Defines an array and accesses array element

The end of a statement

, Argument separation

. Calling operator for methods & objects

: For each loop

[] Literals

Java uses literals to give us an idea of the data type:

Literal Types Example Comments

Integer 10 no distinguisher

Long 100L L for Long

Null null keyword

String “Java Programs” double quotes for a string

Character ‘a’ single quotes for character

Double Floating Point 3123.5 no distinguisher

Floating Point 3.5f f for float

Boolean true keyword for true or false

Other than separators Java also uses literals. Literals give us a brief idea about the data types. Let us view them in a tabular form 

[] Escape Sequences

We use escape sequences in strings to escape a specific character:

Escape Sequence Replaced

/t Horizontal tab

/n New line

/r Carriage return

/f Form feed

/” Double quote

/’ Single quote

// Backslash

[] Chapter 2: About Object Oriented Programming

Java is an object-oriented programming (OOP) language, organized around objects and data instead of actions and logic. Before you can start writing your own Java code, you need to be aware of the basics of the language:

*
p<{color:#000;}. Abstraction – picking out common features of procedures and objects

*
p<{color:#000;}. Class – category of objects, a definition of the properties of the objects in the class

*
p<{color:#000;}. Encapsulation – combining elements to make something new

*
p<{color:#000;}. Information Hiding – hiding details of functions or objects to reduce code complexity

*
p<{color:#000;}. Inheritance – a representation of the “is a” relationship of different classes

*
p<{color:#000;}. Interface – codes and language used by applications to communicate

*
p<{color:#000;}. Messaging – communication form in parallel and OOP programming

*
p<{color:#000;}. Object – self-contained, consisting of procedure and data used for data manipulation

*
p<{color:#000;}. Polymorphism – ability to process an object per its class or data type

*
p<{color:#000;}. Procedure – part of the program that does something specific

[] The Advantages of OOP

The main advantage of OOP is that programmers can create modules that don’t need to be changed when a new object type is added. Programmers can just create a new object that will inherit their features from those that already exist, making it an easy language to modify.

h1<{color:#000;}.

h1<{color:#000;}.

[] Chapter 3: Class Fundamentals

Classes are a fundamental part of Java and are incredibly powerful. A class is used to define a new data type, which is then used to create an object of the type defined. In basic, a class is a template for the object and the object is an instance of the class. Because of that, you will see the words instance and object used interchangeably.

[] The Form of a Class

To define a class, you must declare the exact nature and form of it. To do this, you must specify the data in the class and the code that will operate on the data. Most classes will contain both although some only have data or code in them.

You declare a class by using the class keyword and the following shows you the general form of a class:

             class classname {

     type instance-variable1;

     type instance-variable2;

     // ..

type instance-variableN;

 

type methodname1(parameter-list) {

     //body of method

}

type methodname2(parameter-list) {

     //body of method

}

     //..

type methodnameN(parameter-list) {

     // body of method

}

}

 The variables, or data, that are defined in the class are known as instance variables and the code itself is held within a method. The methods and variables that are defined in a class are called members and, in most cases, the variables will be acted on and accessed by the specific methods in the class. The methods determine how the data is used.

 

[] Chapter 4: Conclusion + FREE BONUS VIDEO COURSE

Finally, if you enjoyed this book, then I’d like to ask you for a favor, would you be kind enough to leave a review? It’d be greatly appreciated!

Thank you again for reading this book!

I hope this book was able to help you to understand the fundamentals of Java programming.

The next step is to take your learning further. Learning the fundamentals is only the beginning, the start of a long and fruitful journey into the world of computer programming.

I recommend you check out this FREE BONUS VIDEO COURSE for more complete information.

If this link does not work go here: http://javavideocourse.weebly.com

 

 

 

 

 

Thank you and good luck!


Java For Beginners. Learn Java Fast.

You want to learn Java Fast but you don’t know where to start? And you don’t have any previous experience? This book will to get you to speed up the basics quickly by learning the fundamentals of Java Programming Fast! You will be guided through the Java language in the shortest possible amount of time. You will be guided step by step through the Java jungle. Everything that we are going to practice will start from the basics. Very clearly written and well organized book for fast learning. All the essential Java keywords, operators, statements, and expressions are explained in great detail. It contains details about the programming language that every beginner should be aware of. Well written, concise explanations and examples of how to do the most common things. You Will Discover: -The Basic Java Syntax: Whitespace, Styles, Comments, Identifiers, Reserved Keywords, Separators, Literals, Escape Sequences... -All About Object Oriented Programming: The Advantages of OOP -The Class Fundamentals: The Form of a Class -The FREE BONUS VIDEO COURSE For more complete information -And Much, Much More... You want to learn the basics of Java in the shortest possible amount of time? You better grab this book and start reading​ it up!

  • ISBN: 9781370214808
  • Author: George L.
  • Published: 2017-03-21 19:50:12
  • Words: 1701
Java For Beginners. Learn Java Fast. Java For Beginners. Learn Java Fast.