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
forsale [732]
3 years ago
7

consider Java and explore its scope rules. One aspect of the scope rules of any language is when data or methods can have the sa

me name. Give examples in Java to illustrate a case where declaring two local variables with the same name in same method is permitted and one where it is prohibited. Are the rules governing redeclaration of local names the same as those governing redeclaring local names that rename class-level names?
Computers and Technology
1 answer:
navik [9.2K]3 years ago
5 0

Answer and Explanation:

Abstract class Point {

   int x = 1, y = 1;

   void move(int dx, int dy) {

       x += dx;

       y += dy;

       alert();

   }

   abstract void alert();

}

abstract class Colored Point extends Point {

   int color;

}

class Simple Point extends Point {

   void alert() { }

}

Here, a class Point is proclaimed that must be declared abstract, in light of the fact that it contains an assertion of a unique strategy named alert. The subclass of Point named Colored Point acquires the dynamic technique alert, so it should likewise be proclaimed theoretical. Then again, the subclass of Point named Simple Point gives a usage of alarm, so it need not be dynamic.

The statement:

Point p = new Point();

would bring about an aggregate time mistake; the class Point can't be launched in light of the fact that it is theoretical. Be that as it may, a Point variable could accurately be instated with a reference to any subclass of Point, and the class Simple Point isn't digest, so the statement:

Point p = new Simple Point();

would be correct. Instantiation of a Simple Point causes the default constructor and field initializers for x and y of Point to be executed.

You might be interested in
Python's ____ mechanism allows the programmer to view an interface for an entire class or an individual method, at the shell pro
eduard

The question above has multiple choices as follows;

a. API

b. docstring

c. help

d. man

Well, I am stuck between B and C. I’ll however settle for (B) docstring.


Python docstrings provide an easier way to associate documentation with python classes, modules and functions. The interactive help function on the other is built in and is intended for interactive use. This function exists to view help interactively. With the help feature, you can quickly learn classes, modules, functions and many more.






8 0
3 years ago
Which of these about non-disclosure agreements is accurate?
grandymaker [24]

Answer: number 2

Explanation: number 2

6 0
2 years ago
Read 2 more answers
If someone you don”t know asks where you go to school, what should you do?
lozanna [386]
When someone asks that do not answer or say you do not feel comfortable telling them
3 0
3 years ago
Read 2 more answers
What does the system software do
inna [77]

Question: what does the system software do

Answer: this is used to run a computer's hardware and application programs.

Explanation: this is used to maintain downloads and other things and keep your computer up to date

question answered by

(jacemorris04)

5 0
3 years ago
What are at least three differences between a personal and non-personal blog?
qwelly [4]
The difference betweeen personal and nonpersonal blogs are that on a personal blog you give out most information you dont want people to know or it is anonomys 
4 0
2 years ago
Other questions:
  • What is the danger in judging someone according to his or her social networking profile
    12·1 answer
  • Easy question how the internet has impacted y’all life
    13·1 answer
  • Why is it important to use standard english when applying for a job
    13·2 answers
  • Scripting languages are distinguished by their ____ types.
    14·1 answer
  • Drivers should scan 10-12 secound down the road looking of potential hazards
    5·1 answer
  • Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
    11·2 answers
  • A citizen of any group both
    6·1 answer
  • When a computer or digital device is used as a storage device or in the facilitation of an offense, it is argued to be ____ to t
    14·1 answer
  • A Lost link is an interruption or loss of the control link between the control station and the unmanned aircraft, preventing con
    10·1 answer
  • What option can be used by a system administrator to ensure that dynamic updates are made only by known clients when you have a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!