1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Artist 52 [7]
3 years ago
6

CHALLENGE ACTIVITY 1.4.1: Basic syntax errors. Type the statements. Then, correct the one syntax error in each statement. Hints:

Statements end in semicolons, and string literals use double quotes. System.out.println("Predictions are hard."); System.out.print("Especially '); System.out.println("about the future."). System.out.println("Num is: " - userName);
Engineering
1 answer:
Lunna [17]3 years ago
8 0

Answer:

Lets check each statement for the errors.

Explanation:

System.out.println("Predictions are hard.");

This statement has no syntax errors. When this statement is executed the following line will be displayed:

Predictions are hard.

System.out.print("Especially ');

This statement is missing the closing quotation mark. A single quotation mark is placed instead of double quotation mark in the statement.

The following error message will be displayed when this program statement will be compiled:

Main.java:15: error: unclosed string literal

String literals use double quotes. So to correct this syntax error, the statement should be changed as follows:

System.out.print("Especially");

The output of this corrected line is as following:

Especially

System.out.println("about the future.").

In this line a period . is placed at the end of the statement instead of a semicolon ; but according to the syntax rules statements should end in semicolons.

The error message displayed when this line is compiled is as following:

Main.java:15: error: ; expected

Main.java:15: error: not a statement

So in order to correct this syntax error the statement should be changed as following:

System.out.println("about the future.");    

The output of this corrected line is as following:

about the future

System.out.println("Num is: " - userName);

There is a syntax error in this statement because of - symbol used instead of +

+ symbol is used to join together a variable and a value a variable and another variable in a single print statement.

The error message displayed when this line is compiled is as following:

Main.java:13: error: bad operand types for binary operator '-'

So in order to correct this syntax error the statement should be changed as following:

System.out.println("Num is: " + userName);

This line will print two things one is the string Num is and the other is the value stored in userName variable.

So let userName= 5 then the output of this corrected line is as following:

Num is: 5

You might be interested in
Who would most likIf you are interested in working for a specific company, what type of job site should you look at for opening?
fredd [130]

Answer:

if you are interested in working for a company then you should opt for c). Company Site

Explanation:

Industries can have the same scope of work but every company has their own way of achieving objectives. You should learn about the company, its job functions and the specific sector you're interested in. Review the current projects they are working on (specific to your job function), and how you can benefit the company on those projects.

5 0
3 years ago
Read 2 more answers
2.5 kg of air at 150 kPa and 12°C is contained in a gas-tight, frictionless piston-cylinder device. The air is now compressed to
Korolek [52]

Answer:

Work input =283.47 KJ

Explanation:

Given that

P_1=150\ KPa

P_2=600\ KPa

T=12°C=285 K

m= 2.5 kg

Given that this is the constant temperature process.

e know that work for isothermal process  

W=P_1V_1\ln \dfrac{P_1}{P_2}

W=mRT\ln \dfrac{P_1}{P_2}

So now putting the values

W=mRT\ln \dfrac{P_1}{P_2}

W=2.5\times 0.287\times 285\ln \dfrac{150}{600}

W=-283.47 KJ

Negative sign indicates that work is done on the system.

So work input =283.47 KJ

8 0
3 years ago
Technician A says that a voltage drop of 0.8 volts on the starter ground circuit is within specifications. Technician B says tha
Romashka-Z-Leto [24]

Answer:

Technician A is wrong

Technician B is right

Explanation:

voltage drop of 0.8 volts on the starter ground circuit is not within specifications. Voltage drop should be within the range of 0.2 V to 0.6 V but not more than that.

A spun bearing can seize itself around the crankshaft journal causing it not to move. As the car ignition system is turned on, the stater may draw high current in order to counter this seizure.

8 0
4 years ago
A force that attempts to decrease the length of a structural member is____
Zielflug [23.3K]
I think its C) compression
4 0
3 years ago
Write a function M-file that takes as input two matrices A and B, and as output produces the product by columns of the two matri
docker41 [41]

Answer:

Here is the code in Matlab for the function.

I have also attached the m file for function as well as the test run of the code  here and screenshot of the result.

Code:

function [ C ] = columnproduct( A, B )

% get the dimesnions of A

sizeA = size(A);

sizeB = size(B);

% check if columns of A are same as rows of B

if(sizeA(2) ~= sizeB(1))

   error('matrix dimensions do not match')

end

% initialize resultant matrix

C = [];

for i = 1:sizeB(2)

   % concatenating product of matrix A with each column of B

   C = [C A*B(:,i)];

end

end

7 0
3 years ago
Other questions:
  • For H2O, determine the specified property at the indicated state.
    15·1 answer
  • I want a problems and there solutions of The inception of cavitation?​
    7·1 answer
  • Consider a unidirectional continuous fiber-reinforced composite with epoxy as the matrix with 55% by volume fiber.i. Calculate t
    10·1 answer
  • 3
    13·1 answer
  • Mechanical clips are used to close bags and keep things together. Investigate the design of various paper clips, hair clips, and
    10·1 answer
  • What kind of microscope would be used to study a whole or opaque object?
    5·1 answer
  • A 400 kg machine is placed at the mid-span of a 3.2-m simply supported steel (E = 200 x 10^9 N/m^2) beam. The machine is observe
    14·1 answer
  • (25 points).The heat is turned on in a building in a cold morning, but the heater does not burnthe natural gas properly and emit
    13·1 answer
  • A glass plate is subjected to a tensile stress of 40 MPa. If the specific surface energy is 0.3 J/m2 and the modulus of elastici
    11·1 answer
  • 7. Technician A says grease is valued for its ability to stay on parts for a long time. Technician B says grease is valued for i
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!