Examlex

Solved

The Following Code Snippet Contains an Error

question 5

Multiple Choice

The following code snippet contains an error. What is the error?
If (cost > 100) ;
{
Cost = cost - 10;
}
System.out.println("Discount cost: " + cost) ;


Definitions:

Call-By-Value

A method of parameter passing in programming where a copy of the actual parameter's value is made and passed to the function, protecting the original value from modification.

Primitive Types

Basic data types built into the language that include int, char, float, and boolean, among others.

Objects

Instances of classes that encapsulate data and functionalities together in object-oriented programming.

Method Signature

A method signature is the part of the method declaration that includes the method's name and parameter types.

Related Questions