View RSS Feed

My Java Tips

  1. Object references

    by , 11-21-2011 at 04:58 PM (My Java Tips)
    In this post, I will be talking about how to refer to an object. I will present a simple example to make things obvious.

    We have a class called Student. It had 2 attributes, getter setter methods and a method named showAll() to show the contents of both the attributes.

    Java Code:
    public class Student {
    	private int id;
    	private String name;
    	public Student(int id, String name) { = id; = name;