Please enable JavaScript.
Coggle requires JavaScript to display documents.
JAVA CORE - Coggle Diagram
JAVA CORE
PROGRAMS:
Java Primitives:
Integer:
- Stores Numeric Data
- Example: "int a = 100000"
- Define an integer with int.
- After writing a value, close the line with system print ending with ';"
Double:
- Stores double digits.
- Example: "double d = 123.4;"
- See how it's printed.
Boolean:
- It's either true or false.
- Example: "boolean var = true;" or "= false;"
- Print (run) this code.
Char:
- It is to store one character.
- Example: "charA = 'A';"
- Be sure to use small quotes, and not double quotes: """
- Char stands for character.
Etc..
- Similar to int, stores less value
- Example "byte a = 1000"
- There are different ways to use primitives.
Java Logical/Rational Operators:
.
- && And
- || or
- == Equal to
- != not equal
- Greater than
= Greater than or equal to
- < Less than
- <= Less than equal to
LOOPS
Definition:
- If you want to see whether the int (integers) are less than any number you want (10)
-
Classes:
private class:
- Only within the class.
- Has to use setters and getters, for the attribute.
-
-
WHAT'S THIS?
Why Java?
- Java is identical to C#
- Most Demanding
- More Tools
- Big Demand for Java Automation Engineers.
What is it?
- Java was created in 1995
- You can run your Java program on different computers.
- Compiles source code, and executes them.
LOOPS:
definition:
- If you KNOW LOOPS you know how ot program.
- Loop is a code that repeats itself if the Boolean is true.
- Nested Loop is a loop inside a loop.
Streps:
- Boolean while = (x <= 4)
System.out.println(); ..
i++;
- for (when you know exactly how many times you want to loop)
- while
- dowhile (just like while but executes one time only)
FORLOOP:
- for (you can have all 3 things here) {}
- break; is meant to break before a line can print.
- continue; instead of breaking the code, it continues it. It can also skip a int or string within the loop.
OOP:
- Class is a car, for example.
- Object is a door in a car, or a window, etc..
- Classes are the blueprint, and objects are the instances of the classes.
- Methods are whatever you want them to be.
Methods:
.
- Static Method
(Belongs to the class. Can be created without an instance of class).
- Constructor Method:
(Initializes objects and has the same name as class).
- Regular Method
(Belong to the object. Can only be called through an instance of class).
Public and Public Void:Public:
- Means public, access modifier
- One of the 3 access modifiers
Void:
- Doesn't return anything, no datatypes.
- Together with Public, means that it's just for the class.
OOP:
- Abstract method
(hides unnecessary info from users)
- Inheritance method
(Inheritance helps to reuse code from the main to sub class).
- Interface method
(Unlike inheritance, where you need only 1 class, for Interface, you can have unlimited classes).
- Polymorphism method
(Has a ton of classes)
- Encapsulation:
(It hides data, and makes it private. Public setter and getter method is used).
- Setters and Getters
(Make your code more private and secure. getVariable, and setVariable.That's how it works).
STRINGS:
Definition:
- During Java, ALWAYS double quote strings.
- Helps to store data in the computer.
- String is just text that is within the double quotes.
Methods:
Syntax:
- To change a string to lower case, use str.toLowerCase().
- Use Google to find: "Java String Methods."
- str1.equals(str2)
means that you can compare 2 strings to find.
- st.substring()
Substring method
Primitive Comparison:
- Use "==" to check if the 2 operators have the same value.
String Comparison:
- Use the str1.equals(str2).
- Please feel free to leave comments by adding: "//"
Primitive Data Types:
- int [a = 12;]
- double [ b = 12.56;]
- Boolean [true;]
- char [d = 'c';]
AUTOMATION:
Definition:
- Automation is about processing information (data)
- Before you can process the data, you need to know how to store data.
Operators:
- = addts two values together
- subtraction = subtracts one value form another
-
- divides one value by another
- % returns the division remainder
- ++ increases the value by 1
- -- decreases the value by 1
Syntax:
- Else/If statements
- This is for Selective Control Statements!!!!!!
If:
- Use if for Java code when a condition is true.
- Less than: a< b
- Less than euqla: a <=b
- Greater than: a>b
- Greater than equal: a >=b
- Equal to: a==b
- Not Equal to: a!=b
Notes:
- For every case, you have to type break;. So that it can exit the switch.
- Switch statements are better instead of spamming other codes.
CATCH
- Instead of shutting down a problem, you try and tach to fix it.
- try {} catch () {}
- Try allows you to define code for erros while being executed.
- Catch allows you to block executed code.
- Try & Catch come together.
- Used to intercept expectations in Java.
Structure:
- Java Privatives
- Strings
- Loops
- ForLoops
- Try and Catch!
- OOP
- Arrays
- API
- Set Maps