Printing int to String in class [duplicate]

This question already has an answer here:

How do I print my Java object without getting “SomeType@2f92e0f4”?

9 answers

So I am having a hard time with converting the int month day and year to a string to display on screen. When it does print out on screen it shows lik this "631987dateType@70dea4e". How do I go about fixing this and why is it doing this.

public class dateType {

private int month;

private int day;

private int year;

public dateType() {

// TODO Auto-generated constructor stub

month = 6;

day = 03;

year = 1987;


public int getMonth() {

return month;


public void...

Read More »

By: StackOverFlow - Monday, 16 April

Related Posts