SlideShare una empresa de Scribd logo
1 de 4
Descargar para leer sin conexión
Core Java

Debasish Pratihari

Type Casting:




Converting one type of data into another must
follow the rules of casting. If a conversion
results in the loss of precision, as in an int
value converted to a short, then the compiler
will issue an error message unless an explicit
cast is made.
a data type with lower precision (fewer bits)
can be converted to a type of higher precision
without explicit casting. To convert a higher
precision type to a lower precision, however,
an explicit cast is required or the compiler will
flag an error.

Primitive Type Conversion Table:

Note :





The symbol C indicates that an explicit
cast is required since the precision is
decreasing.
The symbol A indicates that the precision
is increasing so an automatic cast occurs
without the need for an explicit cast.
N indicates that the conversion is not
allowed.
The * asterisk indicates that the least
significant digits may be lost in the
conversion.

Lecture/core/LF2/05

Page #1

feel the Technology…
Core Java

Debasish Pratihari

&& verses & :


The && operators perform Conditional-AND
operations on two Boolean expressions. These
operators exhibit "short-circuiting" behavior,
which means that the second operand is
evaluated only if needed.



The & operator do the same thing as && but it
does not exhibit "short-circuiting" behavior,
which means that the both operand are
evaluated always.

Enhanced for loop :
Example:1

class LoopDemo{
public static void main(String[] args){
int[] numbers = {1,2,3,4,5,6,7,8,9,10};
for (int item : numbers) {
System.out.println("Count is: " + item);
}
}
}
Example:2

class LoopDemo2{
public static void main(String[] args){
String [] names = {"Debasish","Sushant","Sidharth",
"Sanat","Nayaran"};
for (String name : names) {
System.out.println("Mr. " + name);
}
}
}

Controlling Statement in Java :




The break Statement
o Un-labeled
o Labeled
The continue Statement
o Un-labeled
o Labeled
The return Statement

Lecture/core/LF2/05

Page #2

feel the Technology…
Core Java

Debasish Pratihari

Example of Un-labeled break :
class BreakTest{
public static void main(String args[]){
for( int i=1;i<=5;i++){
System.out.println("Outer loop"+i);
for(int j=10;j<=15;j++){
if(j==12)
break ;
System.out.println("Inner Loop"+j);
}
}
}
}

Example of Labeled break :
class BreakTest{
public static void main(String args[]){
stop:
for( int i=1;i<=5;i++){
System.out.println("Outer loop"+i);
for(int j=10;j<=15;j++){
if(j= =12)
break stop;
System.out.println("Inner Loop"+j);
}
}
}
}

Example of Un-labeled continue :
class ContinueTest{
public static void main(String args[]){
for( int i=1;i<=5;i++){
System.out.println("Outer loop"+i);
for(int j=10;j<=15;j++){
if(j= =12)
continue ;
System.out.println("Inner Loop"+j);
}
}
}
}

Lecture/core/LF2/05

Page #3

feel the Technology…
Core Java

Debasish Pratihari

Example of labeled continue :
class ContinueTest{
public static void main(String args[]){
stop:
for( int i=1;i<=5;i++){
System.out.println("Outer loop"+i);
for(int j=10;j<=15;j++){
if(j==12)
continue stop;
System.out.println("Inner Loop"+j);
}
}
}
}

Variable Scope :
25% 

The Scope of a variable is the part of the program
over which the variable name can be referenced.

class x{
public static void main(String args[]){
int i;
{
int j;
//referring to i and j is ok here
}
//referring to i ok here
//referring to j is not ok here
}
}

Assertion :


An assertion is a statement in the JavaTM
programming language that enables you to test your
assumptions about your program.



Each assertion contains a boolean expression that
you believe will be true when the assertion executes.
If it is not true, the system will throw an error.



The assertion statement has two forms.
o assert Expression1 ;
o assert Expression1 : Expression2 ;
To activate assertions:
o java –ea Test



Lecture/core/LF2/05

Page #4

feel the Technology…

Más contenido relacionado

La actualidad más candente

8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structurejigeno
 
Software Engineering - Module 3: Lesson7
Software Engineering - Module 3: Lesson7Software Engineering - Module 3: Lesson7
Software Engineering - Module 3: Lesson7ArraLafuente
 
Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...
Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...
Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...Jay Baxi
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COdinganna university
 
Std 12 computer java basics part 3 control structure
Std 12 computer java basics part 3 control structureStd 12 computer java basics part 3 control structure
Std 12 computer java basics part 3 control structureNuzhat Memon
 
Generic Programming in java
Generic Programming in javaGeneric Programming in java
Generic Programming in javaGarik Kalashyan
 
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDYC UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDYRajeshkumar Reddy
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#Prasanna Kumar SM
 
Csharp In Detail Part1
Csharp In Detail Part1Csharp In Detail Part1
Csharp In Detail Part1Mohamed Krar
 
Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)Emilio Coppa
 
12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cppsharvivek
 
Interfaces and abstract classes
Interfaces and abstract classesInterfaces and abstract classes
Interfaces and abstract classesAKANSH SINGHAL
 

La actualidad más candente (20)

8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
 
Software Engineering - Module 3: Lesson7
Software Engineering - Module 3: Lesson7Software Engineering - Module 3: Lesson7
Software Engineering - Module 3: Lesson7
 
Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...
Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...
Notes: Verilog Part 2 - Modules and Ports - Structural Modeling (Gate-Level M...
 
Basic Coding In VHDL COding
Basic Coding In VHDL COdingBasic Coding In VHDL COding
Basic Coding In VHDL COding
 
Operators in java
Operators in javaOperators in java
Operators in java
 
Std 12 computer java basics part 3 control structure
Std 12 computer java basics part 3 control structureStd 12 computer java basics part 3 control structure
Std 12 computer java basics part 3 control structure
 
Generic Programming in java
Generic Programming in javaGeneric Programming in java
Generic Programming in java
 
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDYC UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
 
Programming in Arduino (Part 1)
Programming in Arduino (Part 1)Programming in Arduino (Part 1)
Programming in Arduino (Part 1)
 
Csharp In Detail Part1
Csharp In Detail Part1Csharp In Detail Part1
Csharp In Detail Part1
 
Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)Symbolic Execution (introduction and hands-on)
Symbolic Execution (introduction and hands-on)
 
12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp12 computer science_notes_ch01_overview_of_cpp
12 computer science_notes_ch01_overview_of_cpp
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Interfaces and abstract classes
Interfaces and abstract classesInterfaces and abstract classes
Interfaces and abstract classes
 
Abstract class
Abstract classAbstract class
Abstract class
 

Destacado

Right People For The Right Job!
Right People For The Right Job!Right People For The Right Job!
Right People For The Right Job!Geethashree N
 
My Mom On Leadership
My Mom On LeadershipMy Mom On Leadership
My Mom On LeadershipMaja Vujovic
 
Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...
Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...
Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...Paul McElvaney
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disquszeeg
 
Battle of luoisbourg keynote0
Battle of luoisbourg keynote0Battle of luoisbourg keynote0
Battle of luoisbourg keynote0iamcanehdian
 
Learning Pool CELEB event
Learning Pool CELEB eventLearning Pool CELEB event
Learning Pool CELEB eventPaul McElvaney
 
'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society
'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society
'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s SocietyPaul McElvaney
 
Aag presentatie 3 februari
Aag presentatie 3 februariAag presentatie 3 februari
Aag presentatie 3 februariSjef Kerkhofs
 
If there is no fly v2
If there is no fly v2If there is no fly v2
If there is no fly v2Z3roXIII
 
Dansk Internetbrug 2008 Fdim
Dansk Internetbrug 2008 FdimDansk Internetbrug 2008 Fdim
Dansk Internetbrug 2008 FdimOne Trick Pony
 
Lcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievementsLcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievementsAgustin Benito Bethencourt
 
Getting your professional message across
Getting your professional message acrossGetting your professional message across
Getting your professional message acrossRhonda Bracey
 
Pelajaran 1 Bm
Pelajaran 1 BmPelajaran 1 Bm
Pelajaran 1 Bmamoi286
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef frameworkmorgoth
 

Destacado (20)

Right People For The Right Job!
Right People For The Right Job!Right People For The Right Job!
Right People For The Right Job!
 
Bookevent
BookeventBookevent
Bookevent
 
My Mom On Leadership
My Mom On LeadershipMy Mom On Leadership
My Mom On Leadership
 
Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...
Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...
Learning Pool's Elaine Walton & Dave Briggs on 'E-learning for Councillors an...
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disqus
 
Battle of luoisbourg keynote0
Battle of luoisbourg keynote0Battle of luoisbourg keynote0
Battle of luoisbourg keynote0
 
Lezing Xerox
Lezing XeroxLezing Xerox
Lezing Xerox
 
Learning Pool CELEB event
Learning Pool CELEB eventLearning Pool CELEB event
Learning Pool CELEB event
 
'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society
'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society
'E-learning for tackling Dementia' Ed Shrager, Alzheimer’s Society
 
Tibo Lezing 27 mei
Tibo Lezing 27 meiTibo Lezing 27 mei
Tibo Lezing 27 mei
 
Aag presentatie 3 februari
Aag presentatie 3 februariAag presentatie 3 februari
Aag presentatie 3 februari
 
If there is no fly v2
If there is no fly v2If there is no fly v2
If there is no fly v2
 
Dansk Internetbrug 2008 Fdim
Dansk Internetbrug 2008 FdimDansk Internetbrug 2008 Fdim
Dansk Internetbrug 2008 Fdim
 
Lcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievementsLcu14 wrap up meeting. Summary of Core Develoment teams achievements
Lcu14 wrap up meeting. Summary of Core Develoment teams achievements
 
Jane's walk 2012 evolution of ottawa
Jane's walk 2012   evolution of ottawaJane's walk 2012   evolution of ottawa
Jane's walk 2012 evolution of ottawa
 
Getting your professional message across
Getting your professional message acrossGetting your professional message across
Getting your professional message across
 
Vov meeting
Vov meeting Vov meeting
Vov meeting
 
Pelajaran 1 Bm
Pelajaran 1 BmPelajaran 1 Bm
Pelajaran 1 Bm
 
Hare And Tortoise
Hare And TortoiseHare And Tortoise
Hare And Tortoise
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef framework
 

Similar a Lecture 5

Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentalsHCMUTE
 
guia de referencia para a linguagem do fabricante CCS info_syntax.pdf
guia de referencia para a linguagem do fabricante CCS info_syntax.pdfguia de referencia para a linguagem do fabricante CCS info_syntax.pdf
guia de referencia para a linguagem do fabricante CCS info_syntax.pdfSilvanildoManoeldaSi
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Andrzej Jóźwiak
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operatorsmcollison
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Courseparveen837153
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And AnswerJagan Mohan Bishoyi
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answerlavparmar007
 
Java PSkills-session2.pptx
Java PSkills-session2.pptxJava PSkills-session2.pptx
Java PSkills-session2.pptxssuser99ca78
 
C++ unit-1-part-11
C++ unit-1-part-11C++ unit-1-part-11
C++ unit-1-part-11Jadavsejal
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++msharshitha03s
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 

Similar a Lecture 5 (20)

Basic_Java_02.pptx
Basic_Java_02.pptxBasic_Java_02.pptx
Basic_Java_02.pptx
 
Ast transformation
Ast transformationAst transformation
Ast transformation
 
c_tutorial_2.ppt
c_tutorial_2.pptc_tutorial_2.ppt
c_tutorial_2.ppt
 
Introduction to Java Programming Part 2
Introduction to Java Programming Part 2Introduction to Java Programming Part 2
Introduction to Java Programming Part 2
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
guia de referencia para a linguagem do fabricante CCS info_syntax.pdf
guia de referencia para a linguagem do fabricante CCS info_syntax.pdfguia de referencia para a linguagem do fabricante CCS info_syntax.pdf
guia de referencia para a linguagem do fabricante CCS info_syntax.pdf
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
 
Pi j1.3 operators
Pi j1.3 operatorsPi j1.3 operators
Pi j1.3 operators
 
Unit I Advanced Java Programming Course
Unit I   Advanced Java Programming CourseUnit I   Advanced Java Programming Course
Unit I Advanced Java Programming Course
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
Java Fundamentals
Java FundamentalsJava Fundamentals
Java Fundamentals
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And Answer
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
Java PSkills-session2.pptx
Java PSkills-session2.pptxJava PSkills-session2.pptx
Java PSkills-session2.pptx
 
C++ unit-1-part-11
C++ unit-1-part-11C++ unit-1-part-11
C++ unit-1-part-11
 
C tutorial
C tutorialC tutorial
C tutorial
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 

Más de Debasish Pratihari (20)

Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 23
Lecture 23Lecture 23
Lecture 23
 
Lecture 22
Lecture 22Lecture 22
Lecture 22
 
Lecture 21
Lecture 21Lecture 21
Lecture 21
 
Lecture 20
Lecture 20Lecture 20
Lecture 20
 
Lecture 19
Lecture 19Lecture 19
Lecture 19
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 10
Lecture 10Lecture 10
Lecture 10
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture25
Lecture25Lecture25
Lecture25
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Lecture 5

  • 1. Core Java Debasish Pratihari Type Casting:   Converting one type of data into another must follow the rules of casting. If a conversion results in the loss of precision, as in an int value converted to a short, then the compiler will issue an error message unless an explicit cast is made. a data type with lower precision (fewer bits) can be converted to a type of higher precision without explicit casting. To convert a higher precision type to a lower precision, however, an explicit cast is required or the compiler will flag an error. Primitive Type Conversion Table: Note :     The symbol C indicates that an explicit cast is required since the precision is decreasing. The symbol A indicates that the precision is increasing so an automatic cast occurs without the need for an explicit cast. N indicates that the conversion is not allowed. The * asterisk indicates that the least significant digits may be lost in the conversion. Lecture/core/LF2/05 Page #1 feel the Technology…
  • 2. Core Java Debasish Pratihari && verses & :  The && operators perform Conditional-AND operations on two Boolean expressions. These operators exhibit "short-circuiting" behavior, which means that the second operand is evaluated only if needed.  The & operator do the same thing as && but it does not exhibit "short-circuiting" behavior, which means that the both operand are evaluated always. Enhanced for loop : Example:1 class LoopDemo{ public static void main(String[] args){ int[] numbers = {1,2,3,4,5,6,7,8,9,10}; for (int item : numbers) { System.out.println("Count is: " + item); } } } Example:2 class LoopDemo2{ public static void main(String[] args){ String [] names = {"Debasish","Sushant","Sidharth", "Sanat","Nayaran"}; for (String name : names) { System.out.println("Mr. " + name); } } } Controlling Statement in Java :    The break Statement o Un-labeled o Labeled The continue Statement o Un-labeled o Labeled The return Statement Lecture/core/LF2/05 Page #2 feel the Technology…
  • 3. Core Java Debasish Pratihari Example of Un-labeled break : class BreakTest{ public static void main(String args[]){ for( int i=1;i<=5;i++){ System.out.println("Outer loop"+i); for(int j=10;j<=15;j++){ if(j==12) break ; System.out.println("Inner Loop"+j); } } } } Example of Labeled break : class BreakTest{ public static void main(String args[]){ stop: for( int i=1;i<=5;i++){ System.out.println("Outer loop"+i); for(int j=10;j<=15;j++){ if(j= =12) break stop; System.out.println("Inner Loop"+j); } } } } Example of Un-labeled continue : class ContinueTest{ public static void main(String args[]){ for( int i=1;i<=5;i++){ System.out.println("Outer loop"+i); for(int j=10;j<=15;j++){ if(j= =12) continue ; System.out.println("Inner Loop"+j); } } } } Lecture/core/LF2/05 Page #3 feel the Technology…
  • 4. Core Java Debasish Pratihari Example of labeled continue : class ContinueTest{ public static void main(String args[]){ stop: for( int i=1;i<=5;i++){ System.out.println("Outer loop"+i); for(int j=10;j<=15;j++){ if(j==12) continue stop; System.out.println("Inner Loop"+j); } } } } Variable Scope : 25%  The Scope of a variable is the part of the program over which the variable name can be referenced. class x{ public static void main(String args[]){ int i; { int j; //referring to i and j is ok here } //referring to i ok here //referring to j is not ok here } } Assertion :  An assertion is a statement in the JavaTM programming language that enables you to test your assumptions about your program.  Each assertion contains a boolean expression that you believe will be true when the assertion executes. If it is not true, the system will throw an error.  The assertion statement has two forms. o assert Expression1 ; o assert Expression1 : Expression2 ; To activate assertions: o java –ea Test  Lecture/core/LF2/05 Page #4 feel the Technology…