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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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