Skip to content

Commit

Permalink
java-practice-anonymous-object
Browse files Browse the repository at this point in the history
  • Loading branch information
rajjitlai committed Nov 22, 2024
1 parent d38c943 commit abbdf81
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Binary file added Java/practice/AnonymousObject.class
Binary file not shown.
23 changes: 23 additions & 0 deletions Java/practice/AnonymousObject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Person {
String name;
int age;

Person(String name, int age)
{
this.name = name;
this.age = age;
}

void display()
{
System.out.println("Name: " + name
+ ", Age: " + age);
}
}

public class AnonymousObject {
public static void main(String[] args)
{
new Person("John", 30).display();
}
}
Binary file added Java/practice/Person.class
Binary file not shown.

0 comments on commit abbdf81

Please sign in to comment.