Core Java Programming Fundamentals
Core Java Programming Fundamentals
Pramod Dutta
[Link]
Agenda
● Install Java JDK
● Variables
● Data Types
● String Class & Casting
● Operators
a. Arithmetic Operators
b. Assignment Operators
c. Comparison/Relational Operators
d. Logical Operators
[Link]
Agenda
● Math class
● Taking Input
● Conditional Statements ‘if-else’
● Class
● Object
● Mini-Project Problem
[Link]
Install Java
● Install JDK
● Eclipse
● Set the Path Java_home.
[Link]
[Link]
[Link]
[Link]
What is Java?
Java is an object oriented language.
[Link]
Primary goals in the creation of the Java language
[Link]
Primary goals in the creation of the Java language
[Link]
Primary goals in the creation of the Java language
[Link]
Primary goals in the creation of the Java language
[Link]
Core Funda of Java is
Write once and Run anywhere!!
[Link]
Run anywhere ??
JVM Architecture
[Link]
Run anywhere ??
JVM Architecture
Java Development Kit (JDK)
[Link]
JDK > JRE> JVM
Java Development Kit (JDK) used for developing Java applications
JVM (Java Virtual Machine) JVM is responsible for executing the java program line by line,
hence it is also known as an interpreter.
[Link]
JDK > JRE> JVM
[Link]
How Java Works?
401
Response
[Link]
How Java Works?
Source Code -> Compile It (Javac) -> Run the Compiled Code -> JVM
installed on Machines
401
Response
[Link]
Running Java File Using
CMD
[Link]
Move to src
401
Response
java [Link]
[Link]
What does the
compiler do?
- The compiler is a translator that acts as an intermediary between
the programmer and the CPU on the computer.
401
Response
[Link]
Code Structure in Java
401
Response
[Link]
Code Structure in Java
401
Response
[Link]
!Important
- Every line that needs to be executed should be inside a class.
- Declarations and definitions
- class HelloWorld is the class declaration.
- The main is the point from where all the Java programs
start its execution. 401
Response
[Link]
Doubts
Do I have to put Main() Method in every class to run?
[Link]
!Important
Did you know? The [Link]()
displays text in the current line of the console
and then move the cursor to the beginning of
the next line. 401
Response
[Link]
Quiz
Can we execute a java program without a
main method?
401
Response
[Link]
Quiz
Can we execute a java program without a
main method?
[Link]
gram-without-a-main-method
Yes, we can execute a java program without a main method by
using a static block
401
Response
[Link]
What you can Say in
Main Method?
Do something
Do Some Things Again and Again
Do some under this condition 401
Response
[Link]
Variables
A variable is a container (storage area) used to hold data.
Each variable should be given a unique name (identifier).
401
Response
[Link]
Variables
A variable is a storage location paired with an associated symbolic name
(an identifier), which contains some known or unknown quantity of information
referred to as a value.
Variables in Java are strongly typed; thus they all must have a data type
declared with their identifier
[Link]
Where are the variables
stored?
Variables, once declared in the program, are allocated space in memory.
Memory itself is organized as a long collection of one byte after another.
401
Response
[Link]
Variables
local variable
instance variable
static variable
401
Response
[Link]
Variables
401
Response
[Link]
Data Types
Data types are declarations for variables
There are 2 types of Data Types :
Primitive Data types : to store simple values These are the data types of fixed
size.
401
Response
[Link]
Data Types
Non-Primitive Data types : to store complex values
These are of variable size & are usually declared with a ‘new’ keyword.
Eg : String, Arrays
[Link]
Data Types
// A short type is a 16 bit signed integer
short age; // Stores from +32,767 to -32,768
These are the data types of fixed
// An int type is a 32 bit signed integer size.
int age; // Stores from +2,147,483,647 to -2,147,483,648
9,223,372,036,854,775,808
[Link]
Data Types
float radius1 = 0.00000000000863872078f;
[Link](radius1);
double radius = 0.00000000000863872078;
[Link](radius);
401
Response
[Link]
Data Types
401
Response
[Link]
Declaring multiple variables in a
single line
// Group Declarations
401
Response
// Group initializations
int age = 10, height = 5;
double radius = 2.34, area = 4.55;
[Link]
Operations in Java
401
Response
[Link]
Operator precedence
(10 - 4) + 3 *4
401
Response
200 / 50 + (3 * 4)
10+3-4
[Link]
Java Math class
401
Response
[Link]
Comparative operators
401
Response
[Link]
Boolean operators
401
Response
[Link]
Problem Statement
401
Response
[Link]
Problem Statement
● First, compute the respective powers of two
floating-point variables x and y.
● Then Add them after taking powers.
● Then, compute the absolute value of floating-
point z. 401
value.
● Now take Cube Root of the answer.
● Use inbuilt functions to calculate this expression
[Link]
Quiz
● (2+3)-10 * 5;
401
Response
[Link]
String Class
Strings are immutable non-primitive data types in Java.
Once a string is created it’s value cannot be changed
if we wish to alter its value then a new string with a new value
has to be created.
401
Response
[Link]
String Immutability
Keep in mind that String objects are immutable, i.e, they
cannot be modified once created
401
Response
[Link]
String Class
Concatenation
String name1 = new String("Aman");
String description = new String("is a good boy.");
CharAt
String name = new String("Aman"); 401
[Link]([Link](0));
Response
equalsIgnoreCase
Equals Demo
Split String
Substrings
ToUpper
ToLower
[Link]
String Class
Strings are immutable non-primitive data types in Java.
New String is created
401
[Link]
String Class
401
Response
[Link]
String Class
401
Response
[Link]
String Interning is a method of storing only
one copy of each distinct String Value,
which must be immutable.
401
Response
[Link]
String Class
Substring
String name = new String("AmanAndAkku");
[Link]([Link](0, 4));
Length
String name = new String("Aman");
[Link]([Link]()); 401
Response
Replace
String name = new String("Aman");
[Link]([Link]('a', 'b'));
[Link]
Problem String
401
Response
[Link]
Problem String
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
}
}
[Link]
[Link]
Problem String
401
Response
[Link]
[Link]
StringBuilder vs
StringBuffer
401
Response
[Link]
StringBuilder vs
StringBuffer
401
Response
[Link]
Casting
Casting in java is the assigning values of one type to another
Explicit casting
This casting is done by the programmer. It is assigning larger values to smaller
data types.
int price = 100;
float gst = 18.00F;
int finalPrice = price + (int)gst;
[Link]
Casting : Auto widening and explicit
narrowing
The data is implicitly casted from small sized primitive type to big
sized primitive type. This is called auto-widening
The data is automatically casted from byte to short, short to int, int to
long, long to float and float to double.
explicitly convert the data from double to float, float to long, long to int, int to 401
Response
[Link]
Casting : Auto widening and explicit
narrowing
401
Response
[Link]
Constants
A constant is a variable whose value cannot change once it has
been assigned
401
Response
[Link]
Keywords
keywords are also known as reserved
words.
401
Response
[Link]
Operators in Java
● Unary Operator,
● Arithmetic Operator,
● Shift Operator,
● Relational Operator,
● Bitwise Operator, 401
Response
● Logical Operator,
● Ternary Operator and
● Assignment Operator.
[Link]
Operator
Preceden 401
ce
Response
[Link]
Math Class
Math is an important class in Java that is extensively used and has a lot
of interesting functions.
To import - import [Link];
[Link](a, b);
Min
int a = 10;
int b = 20;
[Link](a,b);
Random
int randomNumber = (int)([Link]()*100);
[Link]
Taking Input
We take input using the Scanner class and
input various types of data using it.
To import the Scanner class - import
[Link];
Example :
401
Response
[Link]
Conditional Statements
ifelse
if(boolean) {
//Code
} else { 401
//Code
Response
[Link]
Conditional Statements
ifelse
int age = 30;
if(age > 18) {
[Link]("This is an
adult"); 401
} else {
Response
[Link]("This is not an
adult");
}
[Link]
Coding Exercise
Coding exercise#
Given a number x, you should check
whether it is even or odd.
401
answer.
answer = "odd";
Response
}
return answer;
[Link]
Conditional Statements
switch(expression) Switch
{
case x:
// code block
break;
case y: 401
Response
// code block
break;
default:
// code block
}
[Link]
While Loop
int i = 0;
while (i < 5) {
[Link](i);
i++;
} 401
Response
[Link]
Do While Loop
do-while loop is used to iterate a part of the
program repeatedly, until the specified
condition is true.
do-while loop is called an exit control loop.
401
Response
do{
//code to be executed / loop body
//update statement
}while (condition);
[Link]
[Link]
[Link]
For LOOP
for (int i = 0; i <= 10; i = i + 2) {
[Link](i);
}
401
Response
[Link]
For Each Loop
String[] cars = {"Volvo", "BMW", "Ford",
"Mazda"};
for (String i : cars) {
[Link](i);
} 401
Response
[Link]
Break & Continue
for (int i = 0; i < 10; i++) {
if (i == 4) {
break;
}
[Link](i); 401
Response
[Link]
Break & Continue
for (int i = 0; i < 10; i++) {
if (i == 4) {
continue;
}
[Link](i); 401
Response
[Link]
Conditional Statements
ifelse
Problem
[Link]
es/java-if-else/problem
401
Response
[Link]
Conditional Statements
ifelse
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
Solution
import [Link].*;
import [Link].*;
import [Link].*;
}else{
if(N >= 2 && N <= 5){
[Link]("Not Weird");
}
if(N >= 6 && N <= 20){
[Link]("Weird");
}
if(N > 20){
[Link]("Not Weird");
}
}
[Link]();
}
}
[Link]
Arrays
Like a list of elements of the same type i.e. a list of integers,
marks[2] = 95;
[Link]
Problem Max in Array
Max in ARRAY
Output: 17
[Link]
Functions / Methods
A function is a block of code which takes some input,
performs some operations and returns some output.
The functions stored inside classes are called methods.
The function we have used is called main.
401
Response
[Link]
Problem statement
Write a static method checkSum that adds two integer arguments and returns 0, 1 or 2.
● Takes two integers one and two in its input. Arguments are pass by value to the
method.
● Has a check variable whose value gets updated as explained below.
● Adds num1 and num2, and checks if their sum is less than 100 in which case
○ Sets the value of the check variable to 0.
● If sum is greater than 100
○ Sets the value of the check variable to 1.
● If sum is equal to 100
○ Sets the value of the check variable to 2.
● In the end, it will return the check variable.
[Link]
● public static int checkSum(int one, int two) {
● //Write your code here
● //Declare the necessary variable
● int check;
● int sum = one + two;
● if (sum < 100) {
● check = 0;
● } else if (sum > 100) {
● check = 1;
● } else {
● check = 2;
● }
● return check;
● }
● }
[Link]
Problem
Sample input#
var = 3557
Sample output#
sum = 3 + 5 + 5 + 7 = 20
[Link]
Problems
Todo
problem of sum
max array
Function with return check variable
401
Response
[Link]
package [Link];
int sum= 0;
input = input/10;
[Link](sum);
[Link]
Class
A class is a group of objects which have common
properties. A class can have some properties and
functions (called methods).
The class we have used is Main.
401
Response
[Link]
Objects
Object is an instance of a class. All
data members and member functions
of the class can be accessed with the
help of objects
401
Response
[Link]
Class & Objects
401
Response
[Link]
Class
Every class in Java can be composed of the following elements:
● fields, member variables or instance variables - These are variables that hold data
specific to a particular object. For each object of a class, there is one field.
● member methods or instance methods - These perform operations on objects and are
defined within the class. 401
Response
● static or class fields - These fields are common to any object within the same class.
They can only exist once in the class irrespective of the total number of objects in the
class.
● static or class methods - These methods do not affect a specific object in the class.
● inner classes - At times a class will be defined within a class if it is a subset of another
class. The class contained within another is the inner class.
[Link]
What is your Biggest
takeaway from this...
[Link]
Action Item
Block at least
5-7 hour per
Weekend.
[Link]
ROADMAP
[Link]
[Link]
Topics
[Link]
[Link]
Course Details….
[Link]
ROADMAP - 4 Months
[Link]
● Core java
● OOPs Concepts
● Collection Framework
● Threading
● Design Patterns
[Link]
Core Java
[Link]
Collection Framework
[Link]
[Link]
Threading
[Link]
HackerRank
[Link]
Educative
[Link]
[Link]
Project Overview!!
[Link]
Manual Testing
Projects
[Link]
API Testing Projects
[Link]
Web Automation
Projects
[Link]
[Link]
Roadmap to learn
Selenium
[Link]
Web Automation
Selenium Real World
Projects
[Link]
Key features of Web Automation
Framework used
Key features of Web Automation Framework used :
[Link]
Web Automation -
Selenium
- Grouping.
- Parallel Execution.
- Running on Grid.
- Reports.
- Config Properties.
[Link]
[Link]
[Link]
[Link]
Playwright Self
Added(Pom)
Key features of Web Automation Framework used :
[Link]
API Testing Projects
Manual + Automation
[Link]
Manually Testing the APIs
● End to End Life Cycle of STLC from Req. to Test EXECUTION
● LIVE Manually Testing an APIs
● 4x Examples of Real World Projects
● Quizz AND Interview Prep
[Link]
Key features of API Automation
Framework used
Key features of REST API Automation Framework used : (Supports SOAP(xml) also)
● Cucumber BDD
● Java : most convenient programming language.
● Maven: For build management purpose, a common structure can be maintained very easily
● TestNG: Open source, most used Testing Framework, Amazing annotations
● Allure Reports : As it is most clean automation reports and provides lots of useful annotations as well.
For better documentation, it has been chosen over other reporting tools
● Lombok plugin : It provides very simple logging framework as compared to other logging methods
● HTTP Methods Wrappers available.
● Support to GraphQL (in future)
● JSON Payload easy support.
[Link]
[Link]
Cucumber BDD + Rest
Assured
[Link]
CI/CD
[Link]
TheTestingAcademy Mobile
Automation Framework
[Link]
Resume Building
● Creating a Resume that works
● Help in Job finding and research
● LinkedIn methods to research jobs for Automation
Tester
● Tips and Tricks to get more HR Call
[Link]
Written Notes, (Recordings 24x7)
[Link]
Access to 24x7 LMS
Quiz
Assignments
[Link]
Doubt Session & Group
Discussion
[Link]
Curated Jobs,
Passing Resume to HRs
[Link]
Mock Interview Prep
● Discussion on How to Crack QA
Interview
● How to Prepare for Interview ?
● Tips and Tricks which helped me to
crack QA Interview
● Things you should avoid in QA Interview
[Link]
Certificate of Completion!!
[Link]
TOTAL VALUE
~92,000 (with ai)
- Learn Java from ZERO exp.
- 3-4 Month - LIVE Course worth Rs 45,000
- 5+ Bonus (Manual Course + API Testing
Course) - Rs - 15,000
- SDET Club Access Lifetime. - Rs - 5,999
[Link]
Price Rs 9999
27th APRIL, 9 am to 12 PM (Sat & Sun)
Total Time - 6 Hours per Week
Friday - Doubt (Bi Weekly) - 8 PM -
LIVE Classes*
java
- 3-4 Month - LIVE Course (
- Access to Previous Batch
- Playwright with Java Course*
- 5+ Bonus (Manual Course + API
Testing Course)
- SDET Club Access Lifetime. [Link]
[Link]
Special Class Coupon
Discount: PROMODE
[Link]
[Link]
Price Rs 9999
LIVE Class
[Link]
[Link]
Testimonials
[Link]
BONUS -
Playwright with Java for Web
Automation Testing + API
Testing(+UI)
[Link]
World it be worth it?
Get into a Single course Teaching you
Manual + API + Web Automation
Give you access to [Link] with
4500+ QA?
Lifetime Access and Masterclasses
weekly
Learn from a person 12+ Year Cracked Multiple
companies
[Link]
Important
[Link]
EMI
[Link]
Important
[Link]
Testimonials
[Link]
How can I help?
[Link]
[Link]
[Link]
[Link]
[Link]
Thanks, for attending Class
[Link]