Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 260 Vote(s) - 3.37 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My book: the java journal: first 5 chapters

#1
Chapters 1-5 of the book I wrote: the java journal


Chapters in this book:

Chapter 1: The class
Chapter 2: Comments
Chapter 3: Hello World!
Chapter 4: Java Special Keys
Chapter 5: Primitive data types
Chapter 6: variables
Chapter 7: user input
Procedure 1: simple calculator
Chapter 8: IF Statements
Chapter 9: Loops
Chapter 10: Switch Statements
Chapter 11: Multiple Methods
Procedure 2: Menu Program
Chapter 12: Arrays/ArrayLists
Chapter 13: 2D arrays
Chapter 14: OOP (Object Oriented Programming).
Chapter 15: Threads
Chapter 16: Multi-Threading
Procedure 3: Bank Program
Chapter 17: Recursion
Chapter 18: Algorithms
Chapter 19: Files
Procedure 4: Login System






































Introduction

Java is a very popular object-oriented programming language used in businesses world-wide. With its high level of protection, low virus rate, easy to learn syntax and numerous uses, Java is by far one of the best programming languages out there today. In this book you will be learning Java from a programmers point of view, what this means, is that I will be teaching you the techniques that I use in my every day programming, there are some things in the language that have the same outcome but different syntax, in this book I will be teaching you only the most efficient ways of doing things.


Who Should Read This Book

Beginners, experts and everybody in between should read this book as both a reference and a learning source for the programming language.

We do assume that you have all of the following:

• The Java JDK
• The Eclipse IDE
• The willingness and capacity to learn and comprehend the things written in this book
• The ability to navigate through the Eclipse IDE

THIS IS A PROGRAMMING BOOK, NOT A 'HOW-TO-USE-A-PROGRAM' BOOK.




What This Book Is And Isn't

This book is a way for beginner programmers to learn Java from the basics to the advanced things and for intermediate/ advanced programmers this book is meant to be a reference point. This book is not 'Game Programming 101'.


Things You Should Pay Attention To

In every chapter you will see *,**,***,etc. each time you see something like this it is an 'extra info' point, at the end of each chapter the words/sentences these are on will be explained.

You will also see littler [REMEMBER] sections that will give you little tips for good syntax.


















~~~!!! Unit 1 !!!~~~

Chapter 1 -- The Class
A Java Class is a compiled program (.java file) which has been converted to a different program type (.class file) that the JDK reads and runs. The most basic Java class is composed of the following:

• Public class <ClassName>
• public static void main(String[] args)


public class FirstClass {
public static void main(String[] args) {


}
}

as you can see, in the basic program above we have a class statement and a main method*. Furthermore, you may have noticed the curly brackets, when creating a class/method you must show where it starts and ends with the curly brackets ({ }) inside these brackets is where the code goes. As you can see, the main method is within the class brackets.

[REMEMBER] -- The first letter for a class name should always be capatalised

public class FirstClass { <-- class start
public static void main(String[] args) { <-- main start


} <-- main end
} <-- class end

The Main Method: the main method is used in every single program. This is where the compiler will start to read and perform the actions written in your program.

method*: A Java method is a collection of statements that are grouped together to perform an operation. When you call the print method (chapter 3), for example the system actually executes several statements in order to display message on the console.

A method is made like this:

modifier returnValueType methodName(list of parameters) {
// Method body;
}

• Modifiers: The modifier, which is optional, tells the compiler how to call the method. This defines the access type of the method.
• Return Type: A method may return a value. The returnValueType is the data type of the value the method returns. Some methods perform the desired operations without returning a value. In this case, the returnValueType is the keyword void.
• Method Name: This is the actual name of the method. The method name and the parameter list together constitute the method signature.
• Parameters: A parameter is like a placeholder. When a method is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a method. Parameters are optional; that is, a method may contain no parameters.
• Method Body: The method body contains a collection of statements that define what the method does.



Chapter 2: Comments

A comment is a line in the code for the programmer to read and remind him/her about what the line of code is, what the programmer needs to do, etc. Comments are not read by the compiler thus, they can be anything.

How to create a comment: There are 2 types of comments in Java, the single line comment and the multi-line comment. To create a single line comment you start with // and then put anything you want.

A multi-line comment is a bit more complex than the single line comment. A multiline comment looks like this:

/* start of comment
* all lines except for start and end
* should start like this
end of comment is like this */


public class FirstClass {
public static void main(String[] args) {
//Single line comment!

/*This is the first line
*second line
*third line
end*/
}
}


Chapter 3: Hello World!

The Hello World program is a generic program in all languages, it is a simple console-print out program that says "Hello World!". However, our Hello World program will be a bit more badass than that.


public class FirstClass {
public static void main(String[] args) {
System.out.print("********************************\n");
System.out.print("* *\n");
System.out.print("* *\n");
System.out.print("* Hello World! *\n");
System.out.print("* *\n");
System.out.print("* *\n");
System.out.print("********************************\n");

System.out.println("********************************");
System.out.println("* *");
System.out.println("* *");
System.out.println("* Goodbye World *");
System.out.println("* *");
System.out.println("* *");
System.out.println("********************************");
}
}




As you can see I used two different types of print out statements:
• System.out.print -- This prints out whatever is in the quotations in a single line.
• System.out.println -- This prints out whatever is in the quotations in a new line.

Furthermore, you may notice that after each line of code you can see a ';'. In Java, each line of code ends with ;. Also, in all the print lines you may see '\n' this is called a special sequence and will be covered in the next chapter.

Chapter 4: Java Special Keys

The Java language supports numerous special escape sequences for String* and char ** literals. They are as follows:

\n - new line
\r - carriage return
\f - Formfeed
\b - backspace
\s - space
\t - tab
\" - Double quote
\' - single quote
\\ - backslash (allows you to print out "\")
\ddd - octal character
\uxxxx - Hexadecimal UNICODE character

String*: a string is a line of text like "Hello world"
char**: a char is a single character like 'a' or '1' or '-'. a char is specified with '<char>' instead of "<char>"


Chapter 5: Primitive data types

In Java there are nine primitive data types. Primitive data types are predefined by the language and named by a key word. Let us now look into detail about the nine primitive data types:

• byte - a byte is a small whole number like 68, or 73. They byte has a minimum value of -128 and a maximum value of 127 (inclusive).
• short - the short is a larger whole number than a byte with a minimum value of -32,768 and a maximum value of 32,767 (inclusive).
• int - the int is the most common type of whole number primitive with a minimum value of -2,157,483,648 and a maximum value of 2,147,483,647.
• long - the long is a data typed used for only extremely long numbers. With its capability of going from -9,223,272,036,854,775,808 all the way up to 9,223,372,036,854,775,807 the long is the largest whole number sequence in Java
• float - a float is a data type that can hold non-whole number numbers (10.7, 149.12) and is commonly used instead of the double. The range of the float is beyond the scope of this discussion
• double - the double is a non-whole number (10.7, 1349.432) with the range value beyond the scope of this discussion. This data type, other than the int, is usually the default choice for number sequences.
• boolean - the boolean data type has only two possible values: true or false. you use this data type for simple flags that track true/false condtions.
• char - the char is a single 16-bit unicode character.
• String - the string is a line of text
Reply

#2
Wow bro this is awesome!
Reply

#3
thanks! it took me 2 weeks to write, I put a link to the full thing in a pdf file at the end of the last post
Reply

#4
The Java Journal :wink: Awesome name thought of by the one and only me
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through