Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Usage of This keyword..
public class Main {
int id;
String name;
Main(int i, String n){
id = i;
name = n;
void setData(int id, String name){ = id; = name;
void getData(){
System.out.println(id + " -> " + name);
public static void main(String[] args) {
Main mn = new Main(10, "ten");
mn.setData(20, "twenty");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment