-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path30 .toString() Method.java
More file actions
53 lines (39 loc) · 1005 Bytes
/
30 .toString() Method.java
File metadata and controls
53 lines (39 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package test;
import java.util.Arrays;
import java.util.Scanner;
//import javax.swing.*;
//import java.lang.Math;
//import java.util.Random;
//import java.awt.Color; // abstract window toolkit
//import java.util.Arrays;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.HashMap;
import java.util.*;
public class main {
// toString() .
// toString() :
//
public static void main(String[] args) {
// TODO Auto-generated method stub
// Declare the Scanner library
Scanner scanner = new Scanner(System.in);
Informations info = new Informations("IA",35);
System.out.println(info.toString());
}
}
///// Informations Class
package test;
public class Informations {
private String name;
private int age;
// default Constructor
public Informations(String name_change, int age_change) {
name = name_change;
age = age_change;
}
public String toString() {
return "My info : name (" + name + "), age(" + age + ")";
}
}