FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
01-Core-Java/08-Java-Programs/002-Print-Variables.java at main · shaikbasha-dev/01-Core-Java · GitHub
shaikbasha-dev
/
01-Core-Java
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
01-Core-Java
/
08-Java-Programs
/
002-Print-Variables.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
57 lines (45 loc) · 1.79 KB
Breadcrumbs
01-Core-Java
/
08-Java-Programs
/
002-Print-Variables.java
Copy path
File metadata and controls
57 lines (45 loc) · 1.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
55
56
57
/*
* ============================================================================
* Program Name : Print Variables
* File Name : 002-Print-Variables.java
* Class Name : PrintVariables
*
* Description:
* This program demonstrates how to declare, initialize, and print
* different types of variables in Java.
*
* Objective:
* - Learn how to declare variables.
* - Understand variable initialization.
* - Display variable values using System.out.println().
*
* Author : Shaik Mahaboob Basha
* Repository : 01-Core-Java
* Folder : 08-Java-Programs
* ============================================================================
*/
public
class
PrintVariables
{
// The main() method is the entry point of every Java application.
public
static
void
main
(
String
[]
args
) {
// Declare and initialize an integer variable.
int
age
=
25
;
// Declare and initialize a double variable.
double
salary
=
45000.75
;
// Declare and initialize a character variable.
char
grade
=
'A'
;
// Declare and initialize a boolean variable.
boolean
isJavaEasy
=
true
;
// Declare and initialize a String variable.
String
name
=
"Shaik Mahaboob Basha"
;
// Print the integer variable.
System
.
out
.
println
(
"Age: "
+
age
);
// Output: Age: 25
// Print the double variable.
System
.
out
.
println
(
"Salary: "
+
salary
);
// Output: Salary: 45000.75
// Print the character variable.
System
.
out
.
println
(
"Grade: "
+
grade
);
// Output: Grade: A
// Print the boolean variable.
System
.
out
.
println
(
"Is Java Easy: "
+
isJavaEasy
);
// Output: Is Java Easy: true
// Print the String variable.
System
.
out
.
println
(
"Name: "
+
name
);
// Output: Name: Shaik Mahaboob Basha
}
}
Back
|
FazBrowse Home
|
New Git URL