The Artima Developer Community
Sponsored Link

Java Answers Forum
I have no idea?

1 reply on 1 page. Most recent reply: Feb 12, 2003 8:18 AM by tengtium

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
emre oby

Posts: 1
Nickname: iimrii
Registered: Feb, 2003

I have no idea? Posted: Feb 11, 2003 9:55 PM
Reply to this message Reply
Advertisement
Well I am in college and my MIS teacher gave me this code to anylize and tell what it is doing...Well I have no idea if you guys can give me step by step definition of what this program is doing I would appreciate.



{
public Point (int i, int j) {
xCoord = i;
yCoord = j;
}

public void swap() {
int temp = xCoord;
temp=xCoord;
yCoord= temp;
}

public void printIt() {
System.out.printIn("X coordinate = " + xCoord);
System.out.printIn("Y coordinate = " + yCoord);
}


private int xCoord; //X Coordinate
private int yCoord; //Y Coordinate

}

Public Point () {
xCoord = 0;
yCoord = 0;
}



I would really appreciate if you can tell me each step

Thanks very much in advance.


tengtium

Posts: 3
Nickname: tengtium
Registered: Feb, 2003

Re: I have no idea? Posted: Feb 12, 2003 8:18 AM
Reply to this message Reply

// this is the constructor of the class Point
// if initiate an object of type Point
// this is automaticaly called
// like this
// Point myPoint = new Point(10,10);

public Point (int i, int j) {
xCoord = i;
yCoord = j;
}

// this is a method of the class
// this means that your class Point
// can do this: swap
// it does what name implies
// swap the properties of the class Point
// like this:
// myPoint.swap();
public void swap() {
int temp = xCoord;
temp=xCoord;
yCoord= temp;
}
// this is another method of the class
// this means that your class Point
// can do this: printIt
// it does what name implies
// print the value of the properties of the class Point
// like this:
// myPoint.printIt();

public void printIt() {
System.out.printIn("X coordinate = " + xCoord);
System.out.printIn("Y coordinate = " + yCoord);
}

// this are properties of the class Point
private int xCoord; //X Coordinate
private int yCoord; //Y Coordinate

}


// this is another constructor of the class Point
// if initiate an object of type Point
// this is automaticaly called
// like this
// Point myPoint = new Point();


Public Point () {
xCoord = 0;
yCoord = 0;
}

Flat View: This topic has 1 reply on 1 page
Topic: help! help!help! Previous Topic   Next Topic Topic: how to open new window

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use