Class pointparameters

Assignment Help JAVA Programming
Reference no: EM13165493

What is the output of the following Java program? Explain in terms of how parameters are passed in Java.

import java.awt.*;

class PointParameters

{

          public static void main(String [] args)

         {

                int x = 1, y = 1;

                Point p = new Point(x, y), q = new Point(x, y);

               doubleScale(x, y, p, q);

               System.out.println( "(x,y) = " + new Point(x, y) +

               " p = " + p + " q = " + q);

           }

         private static void doubleScale(int x, int y, Point p, Point q)

          {

                 x *= 2;

                 y *= 2;

                p.x *= 2;

                p.y *= 2;

               q = new Point(x, y);

          }

}

Suppose a similar program were written in C# in which all the parameters were ref parameters. What would the output of that program be?

Reference no: EM13165493

Questions Cloud

You must also do the work of sorting : You must also do the work of sorting in the method. You cannot just call another library method. Use loops to show the data in the original array as well as the repopulated array in ascending order.
What is the chemical formula of the unknown solid : An unknown solid compound containing Pb2+ ion was mixed with 15 mL of 2.0 M HNO3. The mixture bubbled profusely. After complete reaction, it was found that 0.020 moles of CO2 were produced and the original solid was completely consumed.
What is relationship between organizational needs analysis : What is the relationship between organizational needs analysis and strategic planning? How can tying HRD programs to an organizations strategic plan make it easier to justify requests for resources?
What will the maximum temperature reached : what will the maximum temperature reached by the resulting solution? [Assume that there is no heat loss to the container, that the specific heat of the final solution is 4.18 J/g*C, and the density of the final solution is that of water.]
Class pointparameters : What is the output of the following Java program? Explain in terms of how parameters are passed in Java.import java.awt.*;class PointParameters
Determine the density of the metal : A piece of metal with a mass of 18.2 grams was dropped into a graduated cylinder containing 16.50mL of water. The graduated cylinder after the addition of the metal is 18.40. Determine the density of the metal.
How many moles of bi2o3 react : When 338 g of Bi2O3 reacts with excess carbon, how many moles of Bi2O3 react?
Model of employee behaviour : Describe at least three ways that factors in the external environment influence employee behaviour
Describe an example application of polymorphism : Provide and describe an example application of polymorphism that could be used in a program solution. List and describe the class relationships.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Values that occur just once

This list has some values that occur just once (1, 3, 4, 11, 13, 18), some values that occur twice (9, 16), some values that occur three times (14, 19) and a single value that occurs four times (7). Therefore, the call of list.maxCount() should re..

  User session mgr - socket and thread programs

User Session Mgr - Socket and Thread Programs

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Program should assign a seat in the first class

If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..

  Write a method called printlevel

Write a method called printLevel that takes an integer n as a parameter and that prints the values at level n from left to right. The values should be printed one per line.

  Create a gui version of the game mini sudoku.

Each row has the numbers 1 to 6,Each column has the numbers 1 to 6,Each group of 2 rows by 3 columns also has the numbers 1 to 6.

  Write a complete java program assuming that the variables gp

Write a complete java program Assuming that the variables gpa, deanList and studentName have been declared, you should read in the studentName and gpa from keyboard. Write an if statement that adds 1 to deansList and prints studentName to the standar..

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  Make a fourth button called special

Make a fourth button called "special" that does something else notdescribed in the assignment, such as change the background color.

  Write java program to reverse contents of original array

Write down the Java program method named reversal which returns the new array which is a reversal of original array. Use [5.0, 4.4, 1.9, 2.9, 3.4, 3.5] to test method.

  Create java application-input miles driven and gallons used

Create Java application which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display miles per gallon obtained for each tankful.

  Write an interface for an abstract method

Write an interface, PointingDevice, containing:  an abstract method, getXCoord that returns an int and an abstract method, getYCoord that returns an int.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd