SlideShare uma empresa Scribd logo
1 de 1
Examine the following program and thoroughly explain what Is wrong with the code. The
program should print the values 1 through 10. Rewrite the code inside the main method so it
works correctly while maintaining the basic structure of the provided code (l.e., don't rewrite the
code as a for loop or a/while loop). The rewritten code you provide should be able to compile
cleanly and perform the stated task. public class Question { public static void main(String[] args)
{ int counter; while (counter
Solution
public class Question //Here class name is Qusetion { public static void main ( String arg[]
)throws IOException //we need to provide square barces to arguments and we should throws
input output exceptions { int x=0,counter=1; // we should initialize the integer value x to zero
while(counter<=10) //setting counter value up to 10 { x++; // incrementing value of x by 1 at
each time System.out.println(“counter is now #d ― +x); // printing values of x by using
System.out.println only } } }

Mais conteúdo relacionado

Semelhante a Examine the following program and thoroughly explain what Is wrong wit.docx

cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...bhargavi804095
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans incnayakq
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxgerardkortney
 
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)SURBHI SAROHA
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfmayorothenguyenhob69
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxamrit47
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdfsimenehanmut
 
Modify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfModify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfmallik3000
 

Semelhante a Examine the following program and thoroughly explain what Is wrong wit.docx (20)

cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
cpp-streams.ppt,C++ is the top choice of many programmers for creating powerf...
 
Qust & ans inc
Qust & ans incQust & ans inc
Qust & ans inc
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 
C#.net
C#.netC#.net
C#.net
 
C++ loop
C++ loop C++ loop
C++ loop
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
L03vars
L03varsL03vars
L03vars
 
Programming in C (part 2)
Programming in C (part 2)Programming in C (part 2)
Programming in C (part 2)
 
C function
C functionC function
C function
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
Lecture 2 java.pdf
Lecture 2 java.pdfLecture 2 java.pdf
Lecture 2 java.pdf
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docxPROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
PROVIDE COMMENTS TO FELLOW STUDENTS ANSWERS AND PLEASE DON’T SAY G.docx
 
Advanced Web Technology ass.pdf
Advanced Web Technology ass.pdfAdvanced Web Technology ass.pdf
Advanced Web Technology ass.pdf
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Modify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdfModify this code to use multiple threads with the same data1.Modif.pdf
Modify this code to use multiple threads with the same data1.Modif.pdf
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 
C important questions
C important questionsC important questions
C important questions
 
Functions
FunctionsFunctions
Functions
 

Mais de vtuan3

Arrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docxArrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docxvtuan3
 
Arrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docxArrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docxvtuan3
 
Are you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docxAre you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docxvtuan3
 
Are there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docxAre there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docxvtuan3
 
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docxAP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docxvtuan3
 
answers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docxanswers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docxvtuan3
 
Answer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docxAnswer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docxvtuan3
 
Answer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docxAnswer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docxvtuan3
 
Answer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docxAnswer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docxvtuan3
 
Analyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docxAnalyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docxvtuan3
 
Annual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docxAnnual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docxvtuan3
 
Annual editions of journal What will social media look like in the fu.docx
Annual editions of journal  What will social media look like in the fu.docxAnnual editions of journal  What will social media look like in the fu.docx
Annual editions of journal What will social media look like in the fu.docxvtuan3
 
An unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docxAn unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docxvtuan3
 
Analyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docxAnalyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docxvtuan3
 
Analyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docxAnalyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docxvtuan3
 
an102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docxan102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docxvtuan3
 
An unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docxAn unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docxvtuan3
 
Analyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docxAnalyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docxvtuan3
 
Encapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docxEncapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docxvtuan3
 
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docxElijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docxvtuan3
 

Mais de vtuan3 (20)

Arrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docxArrange the following elements from greatest to least tendency to acce.docx
Arrange the following elements from greatest to least tendency to acce.docx
 
Arrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docxArrange the elution sequence of the following compounds by using rever.docx
Arrange the elution sequence of the following compounds by using rever.docx
 
Are you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docxAre you surprised by the variety and range of issues addressed by the.docx
Are you surprised by the variety and range of issues addressed by the.docx
 
Are there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docxAre there ethical considerations we should consider during the the ent.docx
Are there ethical considerations we should consider during the the ent.docx
 
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docxAP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
AP Chemistry Review Questions Integrating Content- Inquiry and Reasoni.docx
 
answers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docxanswers- 22- H lysine- You do not have to write them all out- ow many.docx
answers- 22- H lysine- You do not have to write them all out- ow many.docx
 
Answer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docxAnswer was D) but I need detailed help with steps as to how - On Janua.docx
Answer was D) but I need detailed help with steps as to how - On Janua.docx
 
Answer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docxAnswer the below in your own words- What were the reasons for the deco.docx
Answer the below in your own words- What were the reasons for the deco.docx
 
Answer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docxAnswer in your own words- Would you agree with Karl Marx in saying tha.docx
Answer in your own words- Would you agree with Karl Marx in saying tha.docx
 
Analyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docxAnalyze the role of credit rationing in both a developed country and a.docx
Analyze the role of credit rationing in both a developed country and a.docx
 
Annual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docxAnnual worth calculations require equal life alternatives- T or F - An.docx
Annual worth calculations require equal life alternatives- T or F - An.docx
 
Annual editions of journal What will social media look like in the fu.docx
Annual editions of journal  What will social media look like in the fu.docxAnnual editions of journal  What will social media look like in the fu.docx
Annual editions of journal What will social media look like in the fu.docx
 
An unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docxAn unknown mixture of ions was treated with hydrochloric acid resultin.docx
An unknown mixture of ions was treated with hydrochloric acid resultin.docx
 
Analyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docxAnalyze the role cryptographic algorithms play and explain how these a.docx
Analyze the role cryptographic algorithms play and explain how these a.docx
 
Analyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docxAnalyze and determine which sector- public or private- has greater ins.docx
Analyze and determine which sector- public or private- has greater ins.docx
 
an102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docxan102 Tollowing infrared spectra- Some examples of functional groups a.docx
an102 Tollowing infrared spectra- Some examples of functional groups a.docx
 
An unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docxAn unknown compound is one of the four compounds shown below- It is an.docx
An unknown compound is one of the four compounds shown below- It is an.docx
 
Analyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docxAnalyze the types of informal and formal communication in organization.docx
Analyze the types of informal and formal communication in organization.docx
 
Encapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docxEncapsulation process- Explain this process giving specific detail at.docx
Encapsulation process- Explain this process giving specific detail at.docx
 
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docxElijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
Elijah Murphy studied voice- opera- and Jewish liturgical music at the.docx
 

Último

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Último (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

Examine the following program and thoroughly explain what Is wrong wit.docx

  • 1. Examine the following program and thoroughly explain what Is wrong with the code. The program should print the values 1 through 10. Rewrite the code inside the main method so it works correctly while maintaining the basic structure of the provided code (l.e., don't rewrite the code as a for loop or a/while loop). The rewritten code you provide should be able to compile cleanly and perform the stated task. public class Question { public static void main(String[] args) { int counter; while (counter Solution public class Question //Here class name is Qusetion { public static void main ( String arg[] )throws IOException //we need to provide square barces to arguments and we should throws input output exceptions { int x=0,counter=1; // we should initialize the integer value x to zero while(counter<=10) //setting counter value up to 10 { x++; // incrementing value of x by 1 at each time System.out.println(“counter is now #d ― +x); // printing values of x by using System.out.println only } } }