Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
1- void
2- private
3- static
4- public
Which is correct in Java
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps
Knowledge Booster
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
- import java.util.*; class Money { private int dollar; private int cent; final static int MIN_CENT_VALUE = 0; final static int MAX_CENT_VALUE = 99; public Money() { this.dollar = 0; this.cent = 0; } public Money(int dollar, int cent) { this.dollar = dollar; if (cent > MIN_CENT_VALUE && cent <= MAX_CENT_VALUE) { this.cent = cent; } else { cent = 0; } } public int getDollar() { return this.dollar; } public void setDollar(int dol) { this.dollar = dol; } public int getCent() { return this.cent; } public void setCent(int c) { if (c >= MIN_CENT_VALUE && c <= MAX_CENT_VALUE) { this.cent = c; } } public Money add(Money otherMoney) { Money m = new Money(); m.dollar = this.dollar + otherMoney.dollar; m.cent = this.cent + otherMoney.cent; if (m.cent >= 100) {…arrow_forwardQUESTION 18 Java uses a hybrid typing system: One system for primitives but everything else is an object. True Falsearrow_forwardThere are notable differences between static and instance methods.arrow_forward
- why might we write public get and set methods for private properties? hint: you may want to do a quick internet search for "java getters and setters pros and cons." 1. these public methods give us a way to read and write the values of these properties in a controlled way 2. they make a program run more efficiently 3. if we didn’t, there would be no way to read or write the values of the properties 4. object-oriented languages require us to do thisarrow_forwardConsider the following class declarations in C++:class C {protected: int x;public: void f(){...};};class C1: public C {protected: int x1;public: void h(C *obj){...};};class C2: public C1 {public: int x2;};class C3: public C {public: f(){...};};i. Draw the class hierarchyii. Assume that main contains the following declaration:C1 obj1;For each of the following expressions, say whether it is allowed in the code of main or not (they can be forbidden either because they violate the classdefinition or the protection mechanism)obj1.x , obj1.f() , obj1.x1 , obj1.x2iii. Assume that the body ofC1::h contains the following declarationsC2 *obj2;C3 *obj3;For each of the following expressions, say whether it is allowed in the bodyofC1::hor notobj->x , obj2->x , obj3->xiv. Assume that the body ofC1::h contains the following statementobj->f();Assume that we call C1::h with a parameter (pointing to an object) of classAnd what would be the method executed if f were declared virtual in C?arrow_forwardJavaarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education