Class in Java
package com.company;
class Employee{
int id;
int videos;
String name;
public void printdDetails(){
System.out.println("My id is "+id);
System.out.println("My name is "+name);
}
public int getVideos(){
return videos;
}
}
public class tuts {
public static void main(String[] args) {
Employee aryan = new Employee();
Employee vidhan = new Employee();
// Setting Attributes
aryan.id = 03;
aryan.videos = 36;
aryan.name = "Aryan Sonone";
vidhan.id = 12;
vidhan.videos = 46;
vidhan.name = "Vidhan Laddha";
// Printing Details
aryan.printdDetails();
vidhan.printdDetails();
}
}
Comments
Post a Comment