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
Trava [24]
3 years ago
7

Would these statements cause an error? Why or why not? int year = 2019; int yearNext = 2020; int & ref = year; & ref = y

earNext;
Computers and Technology
1 answer:
zalisa [80]3 years ago
3 0

Answer: YES

Explanation:

int year=2019;

int yearNext=2020;

 int &ref=year;

<em>&ref=yearNext</em>; {This line leads to error as references cannot be reassigned}

(//compilation error: lvalue required as left operand of assignment

) lvalue(&ref) is not something which can be assigned.

To get this better, here are the difference between pointers and reference variables

Pointers

Pointers can be incremented

Array can be formed with pointers

Pointers can be reassigned

Pointer can be declared as void  

Reference variable

References cannot be incremented

Array cannot be formed with references

References cannot be reassigned as references shares the address of the variable its assigned

References can never be void

You might be interested in
What operating system are you using? On most computers, you can answer this question by right-clicking on the "My Computer" icon
Viktor [21]

Explanation:

hbbbbhygjjjjkllkkjhkkky

5 0
2 years ago
Read 2 more answers
The 'client area' of a window is the area used to display the contents of the window (thus a title bar or border would lie outsi
Lady_Fox [76]

Answer:

<u>Window.java</u>

  1. public class Window {
  2.    int width;
  3.    int height;
  4.    public Window(int width, int height){
  5.        this.width = width;
  6.        this.height = height;
  7.    }
  8.    public int getWidth(){
  9.        return width;
  10.    }
  11.    public int getHeight(){
  12.        return height;
  13.    }
  14.    public int getClientAreaHeight(){
  15.        return getHeight();
  16.    }
  17. }

<u>Main.java</u>

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        Window win1 = new Window(12, 15);
  4.        System.out.println(win1.getClientAreaHeight());
  5.    }
  6. }

Explanation:

<u>Window.java</u>

There is a Window class with two int type attributes, width and height (Line 1 - 3).

The constructor of this class will take two inputs, width and height and set these input to its attributes (Line 5 - 8). There are two methods getWidth and getHeight which will return the value of attributes width and height, respectively (Line 10 - 16).

The required new method getClientAreaHeight is defined in line 18 -20. This method will call the getHeight method to return the height value of the window (Line 19).

<u>Main.java</u>

We test the Window class by creating one Window instance and call the getClientAreaHeight method and print the return output (Line 1 -6).

We shall see 15 is printed.

4 0
3 years ago
Which of the following guidelines about forwarding e-mail messages is most appropriate?
valentina_108 [34]
The last option: 

Avoid forwarding e-mail messages unless you have permission to do so.
5 0
3 years ago
Read 2 more answers
What is a primary feature of a digital video camera?
masha68 [24]
The primary feature of a digital video camera is to records video as digital signals. A digital video camera picture out as of live settings, encrypting it into information that can be definite or transcoded into electronic photographic media. A typical digital camera contains of a lens, image sensor, storing media and a number of other characteristics that can be also be initiated on other cameras such as scalable aperture, filters and flash. High feature images and digital video slides can be put in storage and replicated on a computer, CD or writable DVD or on the internet in deprived of any loss of quality.
4 0
3 years ago
Which describes a composite primary key? Check all that apply.
Gemiola [76]
A composite primary key applies to more than one field.  <span>A table can have only one primary key, which may consist of single or multiple fields.</span>
A composite primary key is selected from Design view.  <span>In Design </span>view<span>, you can use the </span>Primary Key<span> button to assign or remove the </span>primary key<span> designation for the </span>selected<span> field or fields.</span>
4 0
3 years ago
Other questions:
  • The physical address assigned each network adapter is called its ________.
    6·1 answer
  • What is the basic difference between a printer and a plotter?​
    12·1 answer
  • The Rule of Thirds is a way to:
    14·1 answer
  • The market is in <br> until the price of goods reflects equal supply and demand.
    10·1 answer
  • How did the internet originate??​
    12·1 answer
  • What usually happens during the investigation &amp; analysis stage of the Systems Life Cycle
    15·1 answer
  • Which generation of computer is most popular and why?
    9·1 answer
  • Assignment 10 - 1/0 Streams and Files Create a C++ a program that will compute the average word length (average number of charac
    13·1 answer
  • 2. The On and Off states are represented by _____________ class 7 number system​
    7·2 answers
  • What should a pie chart represent?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!