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

  The menu is displayed and the user must select

The menu is displayed and the user must select an option (a number between 0 and 7). The action corresponding to the selection is performed, then the menu is displayed again and the user can choose another option.

  Create the working applet to compute tax

Write down a java applet. Your applet assits to find out how much federal tax we require to pay suppose the tax rate is 12%. Create and implement the working applet to compute tax.

  Evaluate the rtas resource requirements

Design and implement a set of classes and interfaces and use them to evaluate the RTA's resource requirements.

  Your letterinventory class must use an array

Your LetterInventory class must use an array of Counter objects. Note that there is no nextChar method in the Scanner class. You must use the next() method and then use a loop through the characters of the token that is returned. Ignore any character..

  Java method that contains code to be executed

Write a short Java method that contains code for which it is probably impossible for that code to ever be executed, but your favorite Java compiler does not detect this fact.

  Describe the steps to program development

What is the function of parseFloat and parseInt and what will be result if we send "abcd" through a prompt() input and pass it through parseInt()?

  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.

  Java program to declares integer array

Write a complete Java program to declares integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, 7}.

  Create a class safestack that implements a stack of strings

Create a class SafeStack that implements a stack of strings

  A java program that will prompt the user to input a file

Write a Java program that will prompt the user to input a file (document) in order to count the frequency of each word. This program will display the frequency of each word sorted alphabetically or by frequency (depending on the preference of the use..

  Write down java console application to add new student

Write down java console application presents the following menu. Add new student and scores in Biology, Physics and chemistry Search for a given student.

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

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