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.
- 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.
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.
Font size:
Interval:
Bookmark:
Java: Learn Java Quickly By Andrei Besedin Copyright 2017
All primitive types have their default value. Sizes are:
Primitive type | Size | Minimum | Maximum |
Boolean | 1-bit | - | - |
char | 16-bit | Unicode 0 | Unicode 2 - 1 |
byte | 8-bit | -128 | +127 |
short | 16-bit | -2 | +2 |
int | 32-bit | -2 | +2 |
long | 64-bit | -2 | +2 |
float | 32-bit | IEEE754 | IEEE754 |
double | 64-bit | IEEE754 | IEEE754 |
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.
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 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.
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).
Font size:
Interval:
Bookmark:
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.
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.