SlideShare ist ein Scribd-Unternehmen logo
1 von 4
Downloaden Sie, um offline zu lesen
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…

Weitere ähnliche Inhalte

Was ist angesagt?

8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
jigeno
 
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
Rajeshkumar Reddy
 
Csharp In Detail Part1
Csharp In Detail Part1Csharp In Detail Part1
Csharp In Detail Part1
Mohamed Krar
 
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
sharvivek
 

Was ist angesagt? (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
 

Andere mochten auch

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 Leadership
Maja Vujovic
 
'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
Paul McElvaney
 
If there is no fly v2
If there is no fly v2If there is no fly v2
If there is no fly v2
Z3roXIII
 
Pelajaran 1 Bm
Pelajaran 1 BmPelajaran 1 Bm
Pelajaran 1 Bm
amoi286
 

Andere mochten auch (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
 

Ähnlich wie Lecture 5

Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
HCMUTE
 
Java PSkills-session2.pptx
Java PSkills-session2.pptxJava PSkills-session2.pptx
Java PSkills-session2.pptx
ssuser99ca78
 

Ähnlich wie 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++
 

Mehr von 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
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
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
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

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…