Fill in the blanks in each of the following:
Each class declaration that begins with keyword must be stored in a file that has exactly the same name as the class and ends with the .java filename extension.
Each class declaration, which begins with “public” keyword should be stored in a file that has exactly the same name as that of the class and ends with .java filename extension.
Explanation of Solution
“public” keyword:
- “public” refers to a Java keyword that declares a member’s access as public.
- Access modifiers are used to set boundaries for member variables and member functions.
- Public members can be retrieved from anywhere in the program.
- That is, they are visible to all other classes.
- Other classes can modify public fields unless the field is declared as final.
Want to see more full solutions like this?
Chapter 3 Solutions
Java How To Program (Early Objects) (10th Edition)
Additional Engineering Textbook Solutions
C Programming Language
Starting Out with C++ from Control Structures to Objects (9th Edition)
Problem Solving with C++ (10th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Starting Out with C++: Early Objects
Java: An Introduction to Problem Solving and Programming (7th Edition)
- Please fill in the blanks for the following statements: To define a class use the keyword ________________ followed by the name of the class.arrow_forwardConsider the following Java classes. Assuming that all of these classes are in the same directory. What will be the output when TestClassC is compiled and run.arrow_forwardAnswer both to get a like or don't attempt.Thanks Question: 3. _________is a correct annotation with respect to JUnits.4. Is it necessary to write the test class to test every class? __________arrow_forward
- Problem 1. Create a program Class and object where a Class is a Animal, with a method of dogBarking. With in the method instead of typical passing of variable on parameter, we use the set and get commands. Filename: Encapsulation.javaarrow_forwardWhat happened after the following Java code is run? - Compiler error - Exception - This final exam is very easy will be displayed - This final exam is easy will be displayedarrow_forwardThis is a debugging question I am struggle with - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code - public class DebugExtendedVacation isChiddOf DebugVacation { public FixDebugExtendedVacation { days = 30; } } ------- // A Vacation is 10 days // but an ExtendedVacation is 30 days public class DebugTen2 { public static void main(String args[]) { DebugVacation myVacation = new DebugVacation(); DebugExtendedVacation yourVacation = new DebugExtendedVacation(); System.out.println("My vacation is for " + myVacation.getDays + " days"); System.out.println("Your vacation is for " + yourVacation.getDays() + " days"); } } ------------- public class DebugVacation { protected int days; public DebugVacations() { days = 10; }…arrow_forward
- Instructions-Java Assignment is to define a class named Address. The Address class will have three private instance variables: an int named street_number a String named street_name and a String named state. Write three constructors for the Address class: an empty constructor (no input parameters) that initializes the three instance variables with default values of your choice, a constructor that takes the street values as input but defaults the state to "Arizona", and a constructor that takes all three pieces of information as input Next create a driver class named Main.java. Put public static void main here and test out your class by creating three instances of Address, one using each of the constructors. You can choose the particular address values that are used. I recommend you make them up and do not use actual addresses. Run your code to make sure it works. Next add the following public methods to the Address class and test them from main as you go: Write getters and…arrow_forwardPlease include doctring, write only in python, and utilize the example code so I understand this program: First, write a class named Movie that has four data members: title, genre, director, and year. It should have: an init method that takes as arguments the title, genre, director, and year (in that order) and assigns them to the data members. The year is an integer and the others are strings. get methods for each of the data members (get_title, get_genre, get_director, and get_year). Next write a class named StreamingService that has two data members: name and catalog. the catalog is a dictionary of Movies, with the titles as the keys and the Movie objects as the corresponding values (you can assume there aren't any Movies with the same title). The StreamingService class should have: an init method that takes the name as an argument, and assigns it to the name data member. The catalog data member should be initialized to an empty dictionary. get methods for each of the data…arrow_forwardThis is a debugging problem - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. I have edited some of the code but I am unsure how to fix the rest - // Application lists valid shipping codes // then prompts user for a code // Application accepts a shipping code // and determines if it is valid import java.util.*; public class DebugEight1 { public static void main(String args[]) { Scanner input = new Scanner(System.in); char userCode; String entry, message; boolean found = false; char[] okayCodes = {'A','C','T','H'}; StringBuffer prompt = new StringBuffer("Enter shipping code for this delivery\nValid codes are: "); for(int x = 0; x < okayCodes.length; ++x) { prompt.append(okayCodes[x]); if(x != (okayCodes.length - 1))…arrow_forward
- How would one go about creating a main class that calls those static classes, but in a seperate java file?arrow_forwardThis is a debugging question I am struggling on - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Code - public class DebugCustomer { protected int idNumber; protected String name; protected double creditLimit; public DebugCustomer(int id, name, double creditLimit) { idNumber = id; name = name; creditLimit = credit; } public void display() { System.out.println("Customer # + idNumber + Name: " + name, "\nCredit limit $" + creditLimit); } } ----- public class DebugCustomerMakingPurchase extends DebugCustomer { private double amountOfPurchase; private boolean overLimit; public DebugCustomerMakingPurchase(int id, String name, double credit, double purchAmount) { amountOfPurchase = purchAmount;…arrow_forwardFor the 8 Java statements below, identify each of the following statements as legal or illegal, and whether legal or not, state whether it represents a "narrowing" or "widening" conversion, or neither.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr