SlideShare a Scribd company logo
Trace the following part of codes step by step. Show exactly what it will print? Public class Final
1 { public static void main (String arg[]) { int []x = {2, 2, 1, 3, 4, 7}; int y; y = x[1] + 1;
System.out.println(y); x[4] = 1; System.out.println(x[x[4]]); y--; System.out.println(x[y]); int z =
x[y + 1]; for (z = 1; z
Solution
Output:
3
2
1
Final output:
3
3
program:
public class FinalOutput {
public static void main(String args[])
{
int []x={2,2,1,3,4,7};
int y;
y=x[1]+1; //y=3 i.e 2+1
System.out.println(y); //print y
x[4]=1; //lacation 4 value tobe chenged to 1
System.out.println(x[x[4]]); //print x[1] value x[4] is 2
y--; //decrease y by 1 so, y=2
System.out.println(x[y]); //print x[2] is 1
int z=x[y+1];
for(z=1;z<=3;z++)
x[z]=2*y-1;
System.out.println("Final output:");
System.out.println(x[z-2]);
System.out.println(x[y]);
}
}

More Related Content

Similar to Trace the following part of codes step by step- Show exactly what it w.docx

Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
Logan Chien
 
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdfFactors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
deepakangel
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
walia Shaan
 
CipherDriver.javapackage Unit_6;import java.util.;public cl.pdf
CipherDriver.javapackage Unit_6;import java.util.;public cl.pdfCipherDriver.javapackage Unit_6;import java.util.;public cl.pdf
CipherDriver.javapackage Unit_6;import java.util.;public cl.pdf
ravikapoorindia
 
Let’s talk about microbenchmarking
Let’s talk about microbenchmarkingLet’s talk about microbenchmarking
Let’s talk about microbenchmarking
Andrey Akinshin
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
optokunal1
 
Object oriented programming (first)
Object oriented programming (first)Object oriented programming (first)
Object oriented programming (first)Hvatrex Hamam
 
package Assignment;import java.util.;public class assignment .pdf
package Assignment;import java.util.;public class assignment .pdfpackage Assignment;import java.util.;public class assignment .pdf
package Assignment;import java.util.;public class assignment .pdf
noelbuddy
 
Hello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfHello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdf
FashionColZone
 
DS LAB RECORD.docx
DS LAB RECORD.docxDS LAB RECORD.docx
DS LAB RECORD.docx
davinci54
 
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
Junha Jang
 
Java exercise1
Java exercise1Java exercise1
Java exercise1
Jainul Musani
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
MaruMengesha
 
Java oops features
Java oops featuresJava oops features
Java oops features
VigneshManikandan11
 
Computer java programs
Computer java programsComputer java programs
Computer java programs
ADITYA BHARTI
 
What is the output of running class GenericMethodDemo of the followi.pdf
What is the output of running class GenericMethodDemo of the followi.pdfWhat is the output of running class GenericMethodDemo of the followi.pdf
What is the output of running class GenericMethodDemo of the followi.pdf
bhim1213
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdf
kokah57440
 
import java.util.Arrays;import components.simplereader.SimpleReade.pdf
import java.util.Arrays;import components.simplereader.SimpleReade.pdfimport java.util.Arrays;import components.simplereader.SimpleReade.pdf
import java.util.Arrays;import components.simplereader.SimpleReade.pdf
sudhinjv
 

Similar to Trace the following part of codes step by step- Show exactly what it w.docx (20)

Java 8 lambda expressions
Java 8 lambda expressionsJava 8 lambda expressions
Java 8 lambda expressions
 
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdfFactors.javaimport java.io.; import java.util.Scanner; class .pdf
Factors.javaimport java.io.; import java.util.Scanner; class .pdf
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
 
CipherDriver.javapackage Unit_6;import java.util.;public cl.pdf
CipherDriver.javapackage Unit_6;import java.util.;public cl.pdfCipherDriver.javapackage Unit_6;import java.util.;public cl.pdf
CipherDriver.javapackage Unit_6;import java.util.;public cl.pdf
 
Let’s talk about microbenchmarking
Let’s talk about microbenchmarkingLet’s talk about microbenchmarking
Let’s talk about microbenchmarking
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
Object oriented programming (first)
Object oriented programming (first)Object oriented programming (first)
Object oriented programming (first)
 
package Assignment;import java.util.;public class assignment .pdf
package Assignment;import java.util.;public class assignment .pdfpackage Assignment;import java.util.;public class assignment .pdf
package Assignment;import java.util.;public class assignment .pdf
 
Hello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdfHello, I need some assistance in writing a java program THAT MUST US.pdf
Hello, I need some assistance in writing a java program THAT MUST US.pdf
 
DS LAB RECORD.docx
DS LAB RECORD.docxDS LAB RECORD.docx
DS LAB RECORD.docx
 
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
 
Java exercise1
Java exercise1Java exercise1
Java exercise1
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_17-Feb-2021_L8-...
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
Computer java programs
Computer java programsComputer java programs
Computer java programs
 
Algorithms with-java-1.0
Algorithms with-java-1.0Algorithms with-java-1.0
Algorithms with-java-1.0
 
What is the output of running class GenericMethodDemo of the followi.pdf
What is the output of running class GenericMethodDemo of the followi.pdfWhat is the output of running class GenericMethodDemo of the followi.pdf
What is the output of running class GenericMethodDemo of the followi.pdf
 
Stars
StarsStars
Stars
 
java slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdfjava slip for bachelors of business administration.pdf
java slip for bachelors of business administration.pdf
 
import java.util.Arrays;import components.simplereader.SimpleReade.pdf
import java.util.Arrays;import components.simplereader.SimpleReade.pdfimport java.util.Arrays;import components.simplereader.SimpleReade.pdf
import java.util.Arrays;import components.simplereader.SimpleReade.pdf
 

More from gtameka

TOPIC- Landslide early warning in Costa Rica- Students are required to (1).docx
TOPIC- Landslide early warning in Costa Rica- Students are required to (1).docxTOPIC- Landslide early warning in Costa Rica- Students are required to (1).docx
TOPIC- Landslide early warning in Costa Rica- Students are required to (1).docx
gtameka
 
Topic option 2- What should the rules be for computer crime- Your pape.docx
Topic option 2- What should the rules be for computer crime- Your pape.docxTopic option 2- What should the rules be for computer crime- Your pape.docx
Topic option 2- What should the rules be for computer crime- Your pape.docx
gtameka
 
Tones Company purchased a warehouse in a downtown district where land.docx
Tones Company purchased a warehouse in a downtown district where land.docxTones Company purchased a warehouse in a downtown district where land.docx
Tones Company purchased a warehouse in a downtown district where land.docx
gtameka
 
Tones Industries has the following patents on its December 31- 2013- b.docx
Tones Industries has the following patents on its December 31- 2013- b.docxTones Industries has the following patents on its December 31- 2013- b.docx
Tones Industries has the following patents on its December 31- 2013- b.docx
gtameka
 
Toni Tornan is a single parent- During 2014 she earned wages $26-550-.docx
Toni Tornan is a single parent- During 2014 she earned wages $26-550-.docxToni Tornan is a single parent- During 2014 she earned wages $26-550-.docx
Toni Tornan is a single parent- During 2014 she earned wages $26-550-.docx
gtameka
 
Toms construction site has a pipe that discharges run off from the sit.docx
Toms construction site has a pipe that discharges run off from the sit.docxToms construction site has a pipe that discharges run off from the sit.docx
Toms construction site has a pipe that discharges run off from the sit.docx
gtameka
 
To achieve long-term prosperity- strategic planners commonly establish.docx
To achieve long-term prosperity- strategic planners commonly establish.docxTo achieve long-term prosperity- strategic planners commonly establish.docx
To achieve long-term prosperity- strategic planners commonly establish.docx
gtameka
 
Tiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docx
Tiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docxTiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docx
Tiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docx
gtameka
 
True or false- Social networking through such services as Facebook- Tw.docx
True or false- Social networking through such services as Facebook- Tw.docxTrue or false- Social networking through such services as Facebook- Tw.docx
True or false- Social networking through such services as Facebook- Tw.docx
gtameka
 
True or False- In a proprietary system- a commercial vendor opens thei.docx
True or False- In a proprietary system- a commercial vendor opens thei.docxTrue or False- In a proprietary system- a commercial vendor opens thei.docx
True or False- In a proprietary system- a commercial vendor opens thei.docx
gtameka
 
TRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docx
TRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docxTRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docx
TRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docx
gtameka
 
True or False Explain Why- 1- SIP and RTP are protocols used to allow.docx
True or False Explain Why- 1- SIP and RTP are protocols used to allow.docxTrue or False Explain Why- 1- SIP and RTP are protocols used to allow.docx
True or False Explain Why- 1- SIP and RTP are protocols used to allow.docx
gtameka
 
True or False 1- The interstellar medium is composed mostly of gaseous.docx
True or False 1- The interstellar medium is composed mostly of gaseous.docxTrue or False 1- The interstellar medium is composed mostly of gaseous.docx
True or False 1- The interstellar medium is composed mostly of gaseous.docx
gtameka
 
True or False (1 point each) 1- TorF NOs is the only form of nitrogen.docx
True or False (1 point each) 1- TorF NOs is the only form of nitrogen.docxTrue or False (1 point each) 1- TorF NOs is the only form of nitrogen.docx
True or False (1 point each) 1- TorF NOs is the only form of nitrogen.docx
gtameka
 
Transform the E-R diagram into a set of relations- Parking Tickets Ta.docx
Transform the E-R diagram into a set of relations-  Parking Tickets Ta.docxTransform the E-R diagram into a set of relations-  Parking Tickets Ta.docx
Transform the E-R diagram into a set of relations- Parking Tickets Ta.docx
gtameka
 
Trace the evolution of the US police system from the --political-- era.docx
Trace the evolution of the US police system from the --political-- era.docxTrace the evolution of the US police system from the --political-- era.docx
Trace the evolution of the US police system from the --political-- era.docx
gtameka
 
Training and DevelopmentSolutionThe various skills that are necessary.docx
Training and DevelopmentSolutionThe various skills that are necessary.docxTraining and DevelopmentSolutionThe various skills that are necessary.docx
Training and DevelopmentSolutionThe various skills that are necessary.docx
gtameka
 
Question 1 This layer of the OSI model is responsible for dialog contr.docx
Question 1 This layer of the OSI model is responsible for dialog contr.docxQuestion 1 This layer of the OSI model is responsible for dialog contr.docx
Question 1 This layer of the OSI model is responsible for dialog contr.docx
gtameka
 
QUESTION 1 The purpose of an audit is to express an opinion on whether.docx
QUESTION 1 The purpose of an audit is to express an opinion on whether.docxQUESTION 1 The purpose of an audit is to express an opinion on whether.docx
QUESTION 1 The purpose of an audit is to express an opinion on whether.docx
gtameka
 
Q0)What are the dye moleclecules doing that makes each specta has a di.docx
Q0)What are the dye moleclecules doing that makes each specta has a di.docxQ0)What are the dye moleclecules doing that makes each specta has a di.docx
Q0)What are the dye moleclecules doing that makes each specta has a di.docx
gtameka
 

More from gtameka (20)

TOPIC- Landslide early warning in Costa Rica- Students are required to (1).docx
TOPIC- Landslide early warning in Costa Rica- Students are required to (1).docxTOPIC- Landslide early warning in Costa Rica- Students are required to (1).docx
TOPIC- Landslide early warning in Costa Rica- Students are required to (1).docx
 
Topic option 2- What should the rules be for computer crime- Your pape.docx
Topic option 2- What should the rules be for computer crime- Your pape.docxTopic option 2- What should the rules be for computer crime- Your pape.docx
Topic option 2- What should the rules be for computer crime- Your pape.docx
 
Tones Company purchased a warehouse in a downtown district where land.docx
Tones Company purchased a warehouse in a downtown district where land.docxTones Company purchased a warehouse in a downtown district where land.docx
Tones Company purchased a warehouse in a downtown district where land.docx
 
Tones Industries has the following patents on its December 31- 2013- b.docx
Tones Industries has the following patents on its December 31- 2013- b.docxTones Industries has the following patents on its December 31- 2013- b.docx
Tones Industries has the following patents on its December 31- 2013- b.docx
 
Toni Tornan is a single parent- During 2014 she earned wages $26-550-.docx
Toni Tornan is a single parent- During 2014 she earned wages $26-550-.docxToni Tornan is a single parent- During 2014 she earned wages $26-550-.docx
Toni Tornan is a single parent- During 2014 she earned wages $26-550-.docx
 
Toms construction site has a pipe that discharges run off from the sit.docx
Toms construction site has a pipe that discharges run off from the sit.docxToms construction site has a pipe that discharges run off from the sit.docx
Toms construction site has a pipe that discharges run off from the sit.docx
 
To achieve long-term prosperity- strategic planners commonly establish.docx
To achieve long-term prosperity- strategic planners commonly establish.docxTo achieve long-term prosperity- strategic planners commonly establish.docx
To achieve long-term prosperity- strategic planners commonly establish.docx
 
Tiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docx
Tiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docxTiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docx
Tiffany MacGraw- a Canadian citizen- left Canada in 2005 to settle in.docx
 
True or false- Social networking through such services as Facebook- Tw.docx
True or false- Social networking through such services as Facebook- Tw.docxTrue or false- Social networking through such services as Facebook- Tw.docx
True or false- Social networking through such services as Facebook- Tw.docx
 
True or False- In a proprietary system- a commercial vendor opens thei.docx
True or False- In a proprietary system- a commercial vendor opens thei.docxTrue or False- In a proprietary system- a commercial vendor opens thei.docx
True or False- In a proprietary system- a commercial vendor opens thei.docx
 
TRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docx
TRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docxTRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docx
TRUE OR FALSE- 1- N- a nonresident alien individual- was born in Count.docx
 
True or False Explain Why- 1- SIP and RTP are protocols used to allow.docx
True or False Explain Why- 1- SIP and RTP are protocols used to allow.docxTrue or False Explain Why- 1- SIP and RTP are protocols used to allow.docx
True or False Explain Why- 1- SIP and RTP are protocols used to allow.docx
 
True or False 1- The interstellar medium is composed mostly of gaseous.docx
True or False 1- The interstellar medium is composed mostly of gaseous.docxTrue or False 1- The interstellar medium is composed mostly of gaseous.docx
True or False 1- The interstellar medium is composed mostly of gaseous.docx
 
True or False (1 point each) 1- TorF NOs is the only form of nitrogen.docx
True or False (1 point each) 1- TorF NOs is the only form of nitrogen.docxTrue or False (1 point each) 1- TorF NOs is the only form of nitrogen.docx
True or False (1 point each) 1- TorF NOs is the only form of nitrogen.docx
 
Transform the E-R diagram into a set of relations- Parking Tickets Ta.docx
Transform the E-R diagram into a set of relations-  Parking Tickets Ta.docxTransform the E-R diagram into a set of relations-  Parking Tickets Ta.docx
Transform the E-R diagram into a set of relations- Parking Tickets Ta.docx
 
Trace the evolution of the US police system from the --political-- era.docx
Trace the evolution of the US police system from the --political-- era.docxTrace the evolution of the US police system from the --political-- era.docx
Trace the evolution of the US police system from the --political-- era.docx
 
Training and DevelopmentSolutionThe various skills that are necessary.docx
Training and DevelopmentSolutionThe various skills that are necessary.docxTraining and DevelopmentSolutionThe various skills that are necessary.docx
Training and DevelopmentSolutionThe various skills that are necessary.docx
 
Question 1 This layer of the OSI model is responsible for dialog contr.docx
Question 1 This layer of the OSI model is responsible for dialog contr.docxQuestion 1 This layer of the OSI model is responsible for dialog contr.docx
Question 1 This layer of the OSI model is responsible for dialog contr.docx
 
QUESTION 1 The purpose of an audit is to express an opinion on whether.docx
QUESTION 1 The purpose of an audit is to express an opinion on whether.docxQUESTION 1 The purpose of an audit is to express an opinion on whether.docx
QUESTION 1 The purpose of an audit is to express an opinion on whether.docx
 
Q0)What are the dye moleclecules doing that makes each specta has a di.docx
Q0)What are the dye moleclecules doing that makes each specta has a di.docxQ0)What are the dye moleclecules doing that makes each specta has a di.docx
Q0)What are the dye moleclecules doing that makes each specta has a di.docx
 

Recently uploaded

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

Trace the following part of codes step by step- Show exactly what it w.docx

  • 1. Trace the following part of codes step by step. Show exactly what it will print? Public class Final 1 { public static void main (String arg[]) { int []x = {2, 2, 1, 3, 4, 7}; int y; y = x[1] + 1; System.out.println(y); x[4] = 1; System.out.println(x[x[4]]); y--; System.out.println(x[y]); int z = x[y + 1]; for (z = 1; z Solution Output: 3 2 1 Final output: 3 3 program: public class FinalOutput { public static void main(String args[]) { int []x={2,2,1,3,4,7}; int y; y=x[1]+1; //y=3 i.e 2+1 System.out.println(y); //print y x[4]=1; //lacation 4 value tobe chenged to 1 System.out.println(x[x[4]]); //print x[1] value x[4] is 2 y--; //decrease y by 1 so, y=2 System.out.println(x[y]); //print x[2] is 1 int z=x[y+1]; for(z=1;z<=3;z++) x[z]=2*y-1; System.out.println("Final output:"); System.out.println(x[z-2]); System.out.println(x[y]);
  • 2. } }