Professional Documents
Culture Documents
@lakhmiswathi992
TestLeafPages
/
Selenium_August_2022
Public
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Selenium_August_2022/Notes/Week1.txt
@TestLeafPages
TestLeafPages Week 1 Code
Latest commit d3e3aa1 2 days ago
History
1 contributor
215 lines (155 sloc) 4.39 KB
Java
Installed JDK 1.8
Eclipse
JDK
JRE - Source code of java and other supported files
JVM - Memory, Compiler, Other components
Environment variable?
IDE
Write - Editor
Correct - Compiler
Run - Execution
Output - Console
Notepad
javac file.java
java file.java
Keywords
keywords always starts with a lower case
keywords should not be used for naming purpose
package -> defines the class belongs which package
public ->
class -> which creates a new class
Variables - Data
Data types
1. Primitive -
2. Derived / user defined
Access modifiers
public - any one inside my project can access
private - any one inside my class can access
package/default/no modifer - any one inside my package can access
protected
Operator
unary
++,--
Incremental operator
decremental operator
binary
Arithmetic operator
+,-,*,/,%
Relational operator
<,<=,>,>=,==,!=
Logical opertor
&& - AND logic 1 && logic 2 = both has to be satisfied
|| - OR logic 1 || logic 2 = any one has to be satisfied
! - NOT !logic 1 -> Not satisfied
ternary
Maven Project
package - should starts with a lower case
Class - should starts with a upper case
Class - Block of code which contains data (variables) and actions (methods).
Variables
Global/class-level variables
dataType variableName = value;
Keywords
package, class, public, private, protected, static, void,
if, byte, short, int, long, float, double, boolean, char
main() -> ?
sysout -> ?
operators
-> unary -> ++,-- -> a++ & ++a
-> binary ->
arithmetic -> +,-,*,/,%
relational -> <,>,<=,>=,==,!=
logical -> &&, ||, !
-> ternary
Conditional statements
If i want to make a decision
Voting both
1. if block alone
if(age > 18){
// true block
allowed to vote
}
3. else if
ranking process in school
if (mark >= 90){
First class
} else if (90 > mark > 80){
Second class
} else if (80 > mark > 70){
Third class
} else if (mark < 35){
fail
}
Constructor
1. Constructor is a spl method which has class name as the method name
2. Constructor do not have any return type
3. Constructor is the gateway to the class
4. Constructor takes the parameter/arg to the class
5. if you have not given the constructor, java will create a virtual
default constructor for the class to create an object.
Array
Array is a concept of storing homogenous type of data.
259619 - names
String name1 = "a";
names = [a,b,c,d,e,...];
Disadvantages of arrays
1. Arrays needs size explicitly or implicitly
2. Arrays can not be extended or shrinked dynamically
1. Print Odd numbers from 51 to 77
2. [22,67,98,1,34,58,99] -> second largest number? -> 98
String
We are going to learn the methods in the string class to manipulate
the String values.
String is immutable in nature.
Footer
© 2022 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Docs
Contact GitHub
Pricing
API
Training
Blog
About
You have no unread notifications