• Complain

Andrei Besedin - Amazing JAVA: Learn JAVA Quickly!

Here you can read online Andrei Besedin - Amazing JAVA: Learn JAVA Quickly! full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Andrei Besedin Amazing JAVA: Learn JAVA Quickly!
  • Book:
    Amazing JAVA: Learn JAVA Quickly!
  • Author:
  • Genre:
  • Year:
    2017
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Amazing JAVA: Learn JAVA Quickly!: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Amazing JAVA: Learn JAVA Quickly!" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Andrei Besedin: author's other books


Who wrote Amazing JAVA: Learn JAVA Quickly!? Find out the surname, the name of the author of the book and a list of all author's works by series.

Amazing JAVA: Learn JAVA Quickly! — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Amazing JAVA: Learn JAVA Quickly!" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make

Java: Learn Java Quickly By Andrei Besedin Copyright 2017

Table of Contents
All Rights Reserved
Without limiting the rights under copyright reserved under, no part of this publication may be reproduced, stored in or introduced into a retrieval system, or transmitted, in any form, or by any means (electronic, mechanical, photocopying, recording, or otherwise) without the prior written permission of the copyright owner.
Chapter 1. Primitive Types
Primitive types are most basic data types that are used in Java. They are stored in variables. Variable is nothing but reserved memory. Size of memory depends of primitive type.

All primitive types have their default value. Sizes are:

Primitive typeSizeMinimumMaximum
Boolean1-bit--
char16-bitUnicode 0Unicode 2 - 1
byte8-bit-128+127
short16-bit-2+2
int32-bit-2+2
long64-bit-2+2
float32-bitIEEE754IEEE754
double64-bitIEEE754IEEE754
Declaration and initialization of primitive types
int a ; int a = 1; int a , b ; int a = 2; int b = 2; finalint a = 15; //constant Declaration means to give variable type along with name: int a ; So, our variable is type of integer and have name a ; Initialization is process of adding value to primitive type, in this case: int a = 0; Before this int have default value. For boolean default value is false , for char is ' \u0000 ', for rest is zero ( ).
Conversation of primitive types
Implicit
int a = 1; double b ; b = a ;
Explicit
long a = 4l; int b = a ; //mistake int c = ( int ) a ; Note : This is called cast operator. Operators will be covered next.
Operators
Arithmetic Operators
Main operators are: + , - , * , / , % y = 5; Operator Result x = y + 1 y = 6 x = y 1 y = 4 x = y % 2 y = 1 x = ++y x = 6; y = 6 x = y++ x = 5; y = 6 x = --y x = 4; y = 4 x = 6 y = 3 Operato r Same a s Result x = y x = 3 x + = y x = x + y x = 9 x - = y x = x y x = 3 x * = y x = x * y x = 18 x / = y x = x / y x = 2 x % = y x = x % y x = 0
Relational Operators
Main operators are: < , > , <= , >= , == , != x = 3 y = 2 Operato r Result x < y false x > y true x <= y false x >= y true x == y false x != y true Arithmetic operators are commonly used, as you guess, in math operations.

Modulo ( % ) can be used to check if number is even or odd for example. Relational operators are very simple. == and != are common used for comparisons. Operator + can be used to concatenate two Strings also.

Logical Operators
Logical operators Main operators are: && (logical AND ), || (logical OR ), ! (logical NOT ) Picture 1Picture 2Picture 3Picture 4Picture 5Picture 6 &&false true || false true! falsefalse falsefalse falsetruefalsetrue true false true true true truetruefalse x = 2 y = 4 Operato r Result ((x< 1) && (y > 3)) false ((x< 5) || (y = 5)) true !(x > y) true
Chapter 2. Java Output
Class System is used for printing to console some text.

Let`s try it on most famous example of your first Java program, Hello World! To do this we need to set up our Java project. First open Eclipse. Creating project in Eclipse is very simple File -> New -> Java Project . Name project as FirstJavaProject and then click Finish . In our project press right click on src folder and create a new package by New -> Package . Name package as first.pack .

Note : Packages are used for better organization of Java classes. In this case we build our own classes, but there are many build-in classes which need some packages to import (java.io, java.util etc). All operations in Java are made in classes . To create them, right click on package New -> Class and name it as JavaClass . Check public static void main (String[]args) and click Finish. Note : public static void main (String[]args) is method which will be explained later.

For now, it is enough to know that in main method are called all other methods in your Java application. This and every other code is supposed to be put inside main method . System. out .println( "Hello World!" ); Our program should look like this: Note There is a one little trick to print this faster Type syso hold ctrl - photo 7 Note : There is a one little trick to print this faster. Type syso, hold ctrl and press space. Then press Enter.

Ok, now this need somehow to be started. To do that press Run -> Run As -> Java Application . expected : Hello World! will be printed to console We learned how to print some massages to console. Let`s now use what we already covered and make some mix with primitive types. Create a new class called PrintPrimitiveTypes and add main method. out .println( "1. out .println( "1.

Old value of b = " + b ); b = a ; System. out .println( "2. New value of b = " + b ); Run application. expected : 1. Old value of b = 3.14 will be printed to console. 2.

New value of b = 2.0 Note : Try it with other operators. For example: int c = 4; b = c * 3.14; System. out .println( "3. New value of b = " + b ); As you can see here is used + operator to chain text with integer. Try to make new examples on your own to feel more comfortable with code writing.

Control Flow Statements
IF
if(condition) action else another action Now we will do some simple example of IF usage.

Make a new class ControFlow and add following lines: int a = 10; if ( a < 11) { System. out .println( "A is less than 10" ); } else { System. out .println( "A is not less than 10" ); } expected : A is less than 10 will be printed to console. Let`s make it a little more difficult. Just like in a real life, you can provide more than one condition for any situation. In this case, it is made by adding else if statement.

Add following lines to current classand run it : int b = 15; if ( b == 13) System. out .println( "b == 13" ); elseif (( b <=17) && ( b >= 12)) System. out .println( "b is less than or equal to 17 and greater than or equal to 12" ); else System. out .println( "b is not any from this" ); expected : b is less than or equal to 17 and greater than or equal to 12 will be printed to console. Program first checks if b == 13, it is not, then checks another condition which is true and print it to console. If this condition was also false, then last one sentence will be printed.

Try to make another condition on your own to see output. You can see that statement works fine also without curly braces. Now we got idea how to make a simple program in Java. Let`s solve this problem. Imagine that you had test in your school. You got some score and grade.

Try to make program, using if statement, to check which grade you got based on your score. Note : First you need to declare two variables score and grade, like this: int grade ; int score = 85; Try it yourself firstly, think about conditions. Here is solution: if ( score >= 95) grade = 10; elseif ( score >= 85) grade = 9; elseif ( score >= 75) grade = 8; elseif ( score >= 65) grade = 7; elseif ( score >= 55) grade = 6; else grade = 5; System. out .println( "Grade is: " + grade ); expected : Grade is: 9 will be printed to console Let`s now see one simple example of code: if ( i < 10) a = i * 100; else a = i * 10; Now look at this code: a = i <10 ? i * 100 : i * 10; This is same thing made in two different ways . Like if/else statement this line of code tells to compile to check if i < 10, if it is true a = i * 100. If it is false, then multiply i with 10 (i * 10).

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Amazing JAVA: Learn JAVA Quickly!»

Look at similar books to Amazing JAVA: Learn JAVA Quickly!. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Amazing JAVA: Learn JAVA Quickly!»

Discussion, reviews of the book Amazing JAVA: Learn JAVA Quickly! and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.