Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following URL address, write segment of codes to get the output shown

ID: 3820919 • Letter: G

Question

Given the following URL address, write segment of codes to get the output shown at the right. String asuURL = www.public asu.edu/-JohnSmith/CSE110; For the following code fragment, int x = 6, y; System.out.printf("mEnter y: "); int y = scan. nextInt(); try {System.out.println("Before"); System.out.println(x/y);} catch (ArithmeticException e) {System.out.println("Wrong");} System.out.println("After"); What will be the output if we enter 3 from the keyboard? What will be the output if we enter 0 from the keyboard?

Explanation / Answer

6. Public class urlsplit

{

Public Static void main(string args[]) throws Exception {

String asuURL= "www.public.asu.edu/~ johnsmith/cse110";

String[] word=assURL.Split("\./");

for(string s:word)

System.out.println(w);

}

the o/p is obtained by for loop, prints each word line by line leaving the special characters.

7.) 1)The output is

Before

2

: beacuse it is a valid expression as 6/3 is 2

2) The output is

Before

Wrong

After

as there is a exception called divide by zero

so catches the exception and prints the statement in exception

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote