Created
August 21, 2015 04:06
-
-
Save smamran/ecd6e43d4a54696d035b to your computer and use it in GitHub Desktop.
Usage of This keyword..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.netcse.java; | |
public class Main { | |
int id; | |
String name; | |
Main(int i, String n){ | |
id = i; | |
name = n; | |
} | |
void setData(int id, String name){ | |
this.id = id; | |
this.name = name; | |
} | |
void getData(){ | |
System.out.println(id + " -> " + name); | |
} | |
public static void main(String[] args) { | |
Main mn = new Main(10, "ten"); | |
mn.setData(20, "twenty"); | |
mn.getData(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment