forked from anisul-Islam/java-documentation-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram5.java
More file actions
31 lines (28 loc) · 763 Bytes
/
Copy pathProgram5.java
File metadata and controls
31 lines (28 loc) · 763 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
/*
* Learning outcomes
* format specifiers
*/
public class Program5 {
public static void main(String[] args) {
// declaring variables for a student
String name;
int id, age;
double gpa;
boolean isRegisted;
// initializing variables for a student
name = "Anisul Islam";
id = 1302020017;
age = 25;
gpa = 3.92;
isRegisted = true;
// printing variables
System.out.println("Student Information");
System.out.println("--------------------");
System.out.printf("Name: "+name);
System.out.printf("Name: %s\n",name);
System.out.printf("ID : %d: \n",id);
System.out.printf("Age: %d\n",age);
System.out.printf("GPA: %.2f\n",gpa);
System.out.printf("Registered: %b\n",isRegisted);
}
}