EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 2, Problem 1RQ
Program Description Answer

After compilation, when a data in the program cannot be changed, then that data is defined as “constant”.

Hence, the correct answer is option “B”.

Expert Solution & Answer
Check Mark

Explanation of Solution

Constant:

The variable is defined as constant variable when the data item cannot be changed while the program is running.

  • Constants are mostly used to define default values.
    • For example: PI has the constant value 3.14.
  • Consider the following statement in a Java class, the number 143 is constant, every time the java application containing the below statement with constant 143 is executed, the value 143 is displayed.

System.out.println(143);

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
I need to make a Java Application in Apache Netbeans 12.5 , I would like to ask for help please. The question is as follows: To encourage good grades, Hermosa High School has decided to award each student a bookstore credit that is 10 times the student’s grade point average. In other words, a student with a 3.2 grade point average receives a R 32 credit. Create a class that prompts a student for a name and grade point average, and then passes the values to a method that displays a descriptive message. The message uses the student’s name, echoes the grade point average, and computes and displays the credit. Save the application as BookstoreCredit.java.
Rooms.txt (427 B) Imagine we were creating a Textbased Adventure Program where a user can navigate through a series of rooms and pick up items, use them, put them down and get points. This assignment has us just reading the rooms of a game from a file into our program and displaying the rooms, not building the entire game. Create a new Java Project. Name it TestReadRoomFile or something like that. Add a Room class to the project according to the following UML. Room -roomNumber: int the room number -roomName: String the name of the room -description: String the description of the room +Room(roomNumber: int, roomName:String, description:String) Constructor. Assign the parameters to the instance variables. +getRoomName():String returns the name of the room +getRoomNumber(): int returns the room number +getDescription(): String returns the description +toString():String returns a string with all the room information. Create a ReadRoomFile class similar to the OOP example…
Write another  Java class named Patient that contains: ■ A private integer data field called id. ■ A private static integer data field called numberOfPatients that counts the number of Patient objects created (default value 0). ■ A private String data field called name. ■ A private Address variable called address. ■ A private File variable called file that refers to a database.txt file. ■ A constructor that creates a patient object with specified name and address. Note that the id of patients is auto-incremented. If 3 patients are created the first one would have id 1, the second id would be 2 and the third id 3. ■ A static method getNumberOfPatients() that returns the number of patients. ■ A method getId() that returns the patient’s id. ■ A toString() method that returns a one-line description of the patient. ■ A savePatientToFile() method that is called every time a new patient object is created to save the patient information (patient object) to the database file.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY