SlideShare a Scribd company logo
1 of 5
Download to read offline
11.
Example1.java
public class Example1 {//main class
public static void main(String args[])
{//main method
for(int i=0;i<10;i++)
{//for loop
if(i%3==1)//if statement
System.out.println(i);
}
}
}
output
1
4
7
12.
Example2.java
public class Example2 {//main class
public static void main(String args[]) {//main method
//for loop
for(int i=2;i>0;i--)
{
System.out.println("!");
}
}
}
output
!
!
13.
Example3.java
public class Example {//main class
public static void main(String args[]) {//main method
int i=0;
while(i<10)
{ //while loop
System.out.println(i);
i++;
}
}
}
output
0
1
2
3
4
5
6
7
8
9
14).
Example4.java
public class Example4 {//main class
public static void main(String args[]) {//main method
for(int i=0;i<3;i++)
{//for loop
for(int j=0;j<=i;j++){//nested for loop
System.out.print(i + j);
System.out.print(" ");
}
System.out.println();
}}
}
output
0
1 2
2 3 4
Solution
11.
Example1.java
public class Example1 {//main class
public static void main(String args[])
{//main method
for(int i=0;i<10;i++)
{//for loop
if(i%3==1)//if statement
System.out.println(i);
}
}
}
output
1
4
7
12.
Example2.java
public class Example2 {//main class
public static void main(String args[]) {//main method
//for loop
for(int i=2;i>0;i--)
{
System.out.println("!");
}
}
}
output
!
!
13.
Example3.java
public class Example {//main class
public static void main(String args[]) {//main method
int i=0;
while(i<10)
{ //while loop
System.out.println(i);
i++;
}
}
}
output
0
1
2
3
4
5
6
7
8
9
14).
Example4.java
public class Example4 {//main class
public static void main(String args[]) {//main method
for(int i=0;i<3;i++)
{//for loop
for(int j=0;j<=i;j++){//nested for loop
System.out.print(i + j);
System.out.print(" ");
}
System.out.println();
}}
}
output
0
1 2
2 3 4

More Related Content

Similar to 11.Example1.java public class Example1 {main class     pub.pdf

Exception Handling
Exception HandlingException Handling
Exception Handling
backdoor
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
knight1128
 
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer DriverBuilding a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
seleniumconf
 

Similar to 11.Example1.java public class Example1 {main class     pub.pdf (20)

Wien15 java8
Wien15 java8Wien15 java8
Wien15 java8
 
core java material.pdf
core java material.pdfcore java material.pdf
core java material.pdf
 
Initial Java Core Concept
Initial Java Core ConceptInitial Java Core Concept
Initial Java Core Concept
 
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
documents.pub_new-features-in-java-8-it-jpoialjavanaitedwien15java8pdf-java-8...
 
Jsp And Jdbc
Jsp And JdbcJsp And Jdbc
Jsp And Jdbc
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Java programming PPT. .pptx
Java programming PPT.                 .pptxJava programming PPT.                 .pptx
Java programming PPT. .pptx
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
Static keyword.pptx
Static keyword.pptxStatic keyword.pptx
Static keyword.pptx
 
Java.lang.object
Java.lang.objectJava.lang.object
Java.lang.object
 
04 threads
04 threads04 threads
04 threads
 
Java For Automation
Java   For AutomationJava   For Automation
Java For Automation
 
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
 
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer DriverBuilding a Driver: Lessons Learned From Developing the Internet Explorer Driver
Building a Driver: Lessons Learned From Developing the Internet Explorer Driver
 
3 j unit
3 j unit3 j unit
3 j unit
 
Best Core Java Training In Bangalore
Best Core Java Training In BangaloreBest Core Java Training In Bangalore
Best Core Java Training In Bangalore
 
Multithreading in Java
Multithreading in JavaMultithreading in Java
Multithreading in Java
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
 

More from sanjeevtandonsre

Nitration occurs through electrophilic addition o.pdf
                     Nitration occurs through electrophilic addition o.pdf                     Nitration occurs through electrophilic addition o.pdf
Nitration occurs through electrophilic addition o.pdf
sanjeevtandonsre
 
Water qualities1. Physical qualitiesOdour and taste unobject.pdf
Water qualities1. Physical qualitiesOdour and taste  unobject.pdfWater qualities1. Physical qualitiesOdour and taste  unobject.pdf
Water qualities1. Physical qualitiesOdour and taste unobject.pdf
sanjeevtandonsre
 
Uses of HRIS SystemsThe principle motivation behind keeping up HR.pdf
Uses of HRIS SystemsThe principle motivation behind keeping up HR.pdfUses of HRIS SystemsThe principle motivation behind keeping up HR.pdf
Uses of HRIS SystemsThe principle motivation behind keeping up HR.pdf
sanjeevtandonsre
 
The moving force behind IT decisions are variable as to what context.pdf
The moving force behind IT decisions are variable as to what context.pdfThe moving force behind IT decisions are variable as to what context.pdf
The moving force behind IT decisions are variable as to what context.pdf
sanjeevtandonsre
 
Physiological responce are those in which the functions of the body .pdf
Physiological responce are those in which the functions of the body .pdfPhysiological responce are those in which the functions of the body .pdf
Physiological responce are those in which the functions of the body .pdf
sanjeevtandonsre
 

More from sanjeevtandonsre (20)

Above 70 °C, sodium bicarbonate gradually decomposes into sodium car.pdf
  Above 70 °C, sodium bicarbonate gradually decomposes into sodium car.pdf  Above 70 °C, sodium bicarbonate gradually decomposes into sodium car.pdf
Above 70 °C, sodium bicarbonate gradually decomposes into sodium car.pdf
 
You need to put your electrons in the first one .pdf
                     You need to put your electrons in the first one .pdf                     You need to put your electrons in the first one .pdf
You need to put your electrons in the first one .pdf
 
PbSO4 is not generally soluble in water. It will .pdf
                     PbSO4 is not generally soluble in water. It will .pdf                     PbSO4 is not generally soluble in water. It will .pdf
PbSO4 is not generally soluble in water. It will .pdf
 
pH is proportional to the cell potential and it i.pdf
                     pH is proportional to the cell potential and it i.pdf                     pH is proportional to the cell potential and it i.pdf
pH is proportional to the cell potential and it i.pdf
 
Nitration occurs through electrophilic addition o.pdf
                     Nitration occurs through electrophilic addition o.pdf                     Nitration occurs through electrophilic addition o.pdf
Nitration occurs through electrophilic addition o.pdf
 
I Hope some more information required to solve th.pdf
                     I Hope some more information required to solve th.pdf                     I Hope some more information required to solve th.pdf
I Hope some more information required to solve th.pdf
 
image not visible .pdf
                     image not visible                                .pdf                     image not visible                                .pdf
image not visible .pdf
 
What is a mistakeSolutionWhat is a mistake.pdf
What is a mistakeSolutionWhat is a mistake.pdfWhat is a mistakeSolutionWhat is a mistake.pdf
What is a mistakeSolutionWhat is a mistake.pdf
 
Water qualities1. Physical qualitiesOdour and taste unobject.pdf
Water qualities1. Physical qualitiesOdour and taste  unobject.pdfWater qualities1. Physical qualitiesOdour and taste  unobject.pdf
Water qualities1. Physical qualitiesOdour and taste unobject.pdf
 
Uses of HRIS SystemsThe principle motivation behind keeping up HR.pdf
Uses of HRIS SystemsThe principle motivation behind keeping up HR.pdfUses of HRIS SystemsThe principle motivation behind keeping up HR.pdf
Uses of HRIS SystemsThe principle motivation behind keeping up HR.pdf
 
The moving force behind IT decisions are variable as to what context.pdf
The moving force behind IT decisions are variable as to what context.pdfThe moving force behind IT decisions are variable as to what context.pdf
The moving force behind IT decisions are variable as to what context.pdf
 
The Canadian city with a pre- 1800 historic heart is QuebecSolut.pdf
The Canadian city with a pre- 1800 historic heart is QuebecSolut.pdfThe Canadian city with a pre- 1800 historic heart is QuebecSolut.pdf
The Canadian city with a pre- 1800 historic heart is QuebecSolut.pdf
 
Solution Millennials referred to as narcissistic referred to as n.pdf
Solution Millennials referred to as narcissistic referred to as n.pdfSolution Millennials referred to as narcissistic referred to as n.pdf
Solution Millennials referred to as narcissistic referred to as n.pdf
 
SolutionThe SELECT DISTINCT stamen will returns distinct values. .pdf
SolutionThe SELECT DISTINCT stamen will returns distinct values. .pdfSolutionThe SELECT DISTINCT stamen will returns distinct values. .pdf
SolutionThe SELECT DISTINCT stamen will returns distinct values. .pdf
 
Starting from the topmost column,1. Cerebellum2. Spinocerebellar.pdf
Starting from the topmost column,1. Cerebellum2. Spinocerebellar.pdfStarting from the topmost column,1. Cerebellum2. Spinocerebellar.pdf
Starting from the topmost column,1. Cerebellum2. Spinocerebellar.pdf
 
Rheumatic fever shows various symptoms and signs, out of which sore .pdf
Rheumatic fever shows various symptoms and signs, out of which sore .pdfRheumatic fever shows various symptoms and signs, out of which sore .pdf
Rheumatic fever shows various symptoms and signs, out of which sore .pdf
 
Physiological responce are those in which the functions of the body .pdf
Physiological responce are those in which the functions of the body .pdfPhysiological responce are those in which the functions of the body .pdf
Physiological responce are those in which the functions of the body .pdf
 
NaF is the only oneSolutionNaF is the only one.pdf
NaF is the only oneSolutionNaF is the only one.pdfNaF is the only oneSolutionNaF is the only one.pdf
NaF is the only oneSolutionNaF is the only one.pdf
 
okkkSolutionokkk.pdf
okkkSolutionokkk.pdfokkkSolutionokkk.pdf
okkkSolutionokkk.pdf
 
Minimum IQ is 131SolutionMinimum IQ is 131.pdf
Minimum IQ is 131SolutionMinimum IQ is 131.pdfMinimum IQ is 131SolutionMinimum IQ is 131.pdf
Minimum IQ is 131SolutionMinimum IQ is 131.pdf
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 

Recently uploaded (20)

21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxMichaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 

11.Example1.java public class Example1 {main class     pub.pdf

  • 1. 11. Example1.java public class Example1 {//main class public static void main(String args[]) {//main method for(int i=0;i<10;i++) {//for loop if(i%3==1)//if statement System.out.println(i); } } } output 1 4 7 12. Example2.java public class Example2 {//main class public static void main(String args[]) {//main method //for loop for(int i=2;i>0;i--) { System.out.println("!"); } } } output ! !
  • 2. 13. Example3.java public class Example {//main class public static void main(String args[]) {//main method int i=0; while(i<10) { //while loop System.out.println(i); i++; } } } output 0 1 2 3 4 5 6 7 8 9 14). Example4.java public class Example4 {//main class public static void main(String args[]) {//main method for(int i=0;i<3;i++) {//for loop for(int j=0;j<=i;j++){//nested for loop System.out.print(i + j); System.out.print(" "); } System.out.println(); }}
  • 3. } output 0 1 2 2 3 4 Solution 11. Example1.java public class Example1 {//main class public static void main(String args[]) {//main method for(int i=0;i<10;i++) {//for loop if(i%3==1)//if statement System.out.println(i); } } } output 1 4 7 12. Example2.java public class Example2 {//main class public static void main(String args[]) {//main method //for loop for(int i=2;i>0;i--) {
  • 4. System.out.println("!"); } } } output ! ! 13. Example3.java public class Example {//main class public static void main(String args[]) {//main method int i=0; while(i<10) { //while loop System.out.println(i); i++; } } } output 0 1 2 3 4 5 6 7 8 9 14). Example4.java public class Example4 {//main class public static void main(String args[]) {//main method
  • 5. for(int i=0;i<3;i++) {//for loop for(int j=0;j<=i;j++){//nested for loop System.out.print(i + j); System.out.print(" "); } System.out.println(); }} } output 0 1 2 2 3 4