Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class potpie {
- private int month;
- private int day;
- private int year;
- public potpie(int m, int d, int y){
- month = m;
- day = d;
- year = y;
- System.out.printf("The constructor for this is %s\n", this );
- }
- public String toString(){
- return String.format("%d/%d/%d", month, day, year);
- }
- }
- //Class Tuna
- public class Tuna {
- private String name;
- private potpie birthday;
- public Tuna(String theName, potpie theDate){
- name = theName;
- birthday = theDate;
- }
- public String toString(){
- return String.format("My name is %s my Bday is %s ", name, birthday);
- }
- }
- //Main Class, apples
- import java.util.Scanner;
- class apples{
- public static void main(String args[]){
- potpie potObject = new potpie(14,12,1993);
- Tuna tunaObject = new Tuna("Aminpro", potObject);
- System.out.println(tunaObject);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement