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
Aleksandr-060686 [28]
4 years ago
8

Retype the statements, correcting the syntax errors.

Computers and Technology
1 answer:
Leto [7]4 years ago
6 0
<h2>Answer:</h2>

So here is the code for which the given statement are required to be retyped correcting the syntax errors.

import java.util.Scanner;

public class Errors {

  public static void main (String [] args) {

     int songNum = 5;

          return; }}

<h2>Explanation:</h2><h2>Statement 1: </h2>

System.out.println("Num: " + songnum);

Error generated:

error: cannot find symbol

Reason:

The reason of this error is that the variable used in the given chunk of code is songNum but the variable used in this statement to display the number is songnum. JAVA is a case sensitive programming language so it will consider both songNum and songnum to be different variables.

Solution:

The correct statement should be:

System.out.println("Num: " + songNum);

As a result of this statement the output will display value of songNum as:

Num: 5

<h2>Statement 2: </h2>

System.out.println(int songNum);

Errors generated:

error: '.class' expected

error: ';' expected

Reason

These errors come when happen when the compiler detects a missing character in your code. A variable should be declared outside this statement. Int should not be placed here.

Solution:

Remove int from the statement in order to display the value of songNum in output. Correct statement is :

System.out.println songNum);

The output after the statement is corrected:

5

<h2>Statement 3:</h2>

Error Generated:

error: illegal start of expression

Reason:

The compilers give such an error when it detects something against the JAVA programming syntactical rules. As we can see here that the variable songNum and the string "songs" is not separated correctly.

Solution:

The concatenation between two strings or a variable and a string is done in JAVA by using + operator. So by adding + operator between the two, the error can be resolved.

Correct statement:

System.out.println(songNum+ " songs");

The output after the corrected statement is:

5 songs

You might be interested in
1. Write a SELECT statement that returns these columns: The count of the number of orders in the Orders table The sum of the Tax
Arada [10]

Answer:

SELECT

COUNT(SN), SUM(TaxAmount)

FROM ORDERS  

or

SELECT

COUNT(SN) AS NumOrder, SUM(TaxAmount) As TotalTax

FROM ORDERS

Explanation:

Finding it difficult to add my explanation. So, I used an attachment instead

<em />

Download docx
8 0
3 years ago
__________ may be defined as the application of methods and means to ensure that test results are reliable and valid, and errors
kow [346]

Answer:

Quality assurance

Explanation:

8 0
3 years ago
Access Office Equipment has shifted to sales and service of laptops and PCs, where it has the potential to triple the number of
AleksAgata [21]

Answer:

Access Office Equipment is implementing a growth strategy.

Explanation:

Growth strategy can be defined as the strategy whose goal is to win market shares in a greater quantity. The earnings in growth strategy might be short-termed. The common growth strategies include:

  • product expansion
  • market expansion
  • market penetration
  • acquisition and diversification

I hope it will help you!

4 0
4 years ago
Which shortcut key in Microsoft Word 2016 will launch Spell Checker?
Pie

Alt + F7 will launch spell checker

4 0
3 years ago
Read 2 more answers
Trình bày chuẩn giao tiếp cổng USB
Viktor [21]
Wing wing wong wu wang
3 0
3 years ago
Other questions:
  • Why do networks need standards?
    12·1 answer
  • Describe the role of a chemist and the role of a chemical engineer
    9·1 answer
  • An online conference room reservation system lets a user reserve rooms. The user is required to enter contact information and re
    13·1 answer
  • Each time the enter key is pressed, word creates a new paragraph. (points : 2) true false
    7·1 answer
  • Write a program to enter a number and test if it is greater than 45.6. If the number entered is greater than 45.6, the program n
    10·1 answer
  • Describe how operating system use the following security tools: firewall, automatic updating, antivirus software, spyware and ma
    11·1 answer
  • Describe the purpose of shell scripts. Provide one example to reflect the use of variables, constructs, or functions.
    11·1 answer
  • Which is the smallest form of data <br>a)bit <br>b)byte<br>c)nibble<br>d)8 binary digits<br>​
    10·1 answer
  • Which are examples of ribbon customizations?
    11·1 answer
  • What would the theoretical variance (square of the standard deviation) of the following random values be? rand(Normal(80, 10), 2
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!