Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What will the following code print out when it is run? Scanner scan = new Scanner(Hello world this is a new line!); scan.nextLine(); scan.next();

1.

What will the following code print out when it is run?

Scanner scan = new Scanner("Hello world this is a new line!"); scan.nextLine(); scan.next(); scan.next(); System.out.print(scan.next());

Group of answer choices

this

new

a

is

line!

2.

What is the output from the following code?

String s = "University of Wisconsin"; String s1 = s.substring(10,13); String s2 = s1.substring(2); String s3 = s2.trim(); System.out.println("#" + s3 + "#");

Group of answer choices

#o#
# of #
#f#
#of#

3.

What will be printed out when the following code is run?

int x = 0; int y = 3; if (x > 0 || (y / x) == 3) System.out.println("true"); else System.out.println("false");

Group of answer choices

false

divide by zero error

true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions