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
Technologies are having a negative impact on businesses.
Aloiza [94]

Answer: False

Explanation: I think its false because technologie has had a good impact on businesses.

4 0
3 years ago
35 POINTS
Ierofanga [76]

Answer:

Complete the program as follows:

1. Replace

String combo =

with

String combo = customerOrder.substring(0);

2. Replace

Integer comboNumber =

with

Integer comboNumber = Integer.parseInt(combo);

Explanation:

Required

Fill in the missing codes

From the code given, there are only two gaps to be filled and they are:

1. String combo =

2. Integer comboNumber =

1. String combo =

The first is to get the first index of customerOrder using substring.

The syntax of this is:

variable.substring(0);

In this case, the syntax will be replaced with:

<em>String combo = customerOrder.substring(0);</em>

Where customerOrder represents the string variables

2. Integer comboNumber =

This is to convert combo from string to integer using parseInt

This is done as follows:

Integer comboNumber = Integer.parseInt(combo);

<em>See attachment for complete code</em>

Download txt
7 0
3 years ago
Students are studying the effects of beach pollution by counting populations of seagulls at two different beach locations. One l
KIM [24]

Answer:

The number of seagulls in each location.

Explanation:

Dependent variables are something that you are recording or measuring.

7 0
3 years ago
ANSWER QUICKLY!!! <br><br> What is an advantage of digital portfolios?
algol13
Easy to carry or utilize
8 0
2 years ago
If a user would like to modify margins to specific settings, users would need to select the _____ option.
RSB [31]
If a user would like to modify margins to specific settings, users would need to select the <span><u>Custom Margins</u> </span>option.
4 0
4 years ago
Other questions:
  • Write a program that takes as input an arithmetic expression followed by a semicolon ";". The program outputs whether the expres
    11·1 answer
  • Software design and implementation are interleaved activities. The level of detail in the design depends on the type of system b
    5·1 answer
  • In Python, arrays are usually reserved for
    12·1 answer
  • You want to create Web pages that can easily adapt to and serve multimedia content to smartphones, tablets, gaming devices and s
    13·1 answer
  • Which table attributes would this code produce?
    15·1 answer
  • What is the term for an understanding about the processes that underlie memory, which emerges and improves during middle childho
    7·2 answers
  • Whay is processing?Explain with an example.​
    9·2 answers
  • Assume that you have the business data in various sources such as Excel, .csv, text files and Access, Oracle databases. Write th
    9·1 answer
  • Where can formatting features be found ?! Need help asp !‍♀️
    9·1 answer
  • Which of the listed tools would a barber likely use in the following scenario?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!