From f0146f760e6e85373ae2b5ecb2879d6ba2604284 Mon Sep 17 00:00:00 2001 From: Mayank Yadav Date: Sun, 12 Oct 2025 23:03:22 +0530 Subject: [PATCH] Update q1.java --- q1/q1.java | 66 ++++++++++++++++++++---------------------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/q1/q1.java b/q1/q1.java index 17e9650..8e8243a 100644 --- a/q1/q1.java +++ b/q1/q1.java @@ -1,47 +1,29 @@ -// FILL HERE: Import the necessary package for input operations +// Mayank Yadav +import java.util.Scanner; +public class q1 { + public static void main(String[] args) { -// FILL HERE: Write the class declaration with proper naming convention -{ - // FILL HERE: Write the main method signature - { - // Variable declarations and initialization - // FILL HERE: Declare an integer variable named 'age' and initialize it to 25 + String n = "John Doe"; + int a = 25; + double h = 5.8; + char g = 'A'; + boolean isStudent = true; - // FILL HERE: Declare a double variable named 'height' and initialize it to 5.8 - - // FILL HERE: Declare a char variable named 'grade' and initialize it to 'A' - - // FILL HERE: Declare a boolean variable named 'isStudent' and initialize it to true - - // FILL HERE: Declare a String variable named 'name' and initialize it to "John Doe" - - - // Output statements System.out.println("=== Student Information ==="); - - // FILL HERE: Print the name using System.out.println - - // FILL HERE: Print the age using System.out.println (format: "Age: 25") - - // FILL HERE: Print the height using System.out.println (format: "Height: 5.8 feet") - - // FILL HERE: Print the grade using System.out.println (format: "Grade: A") - - // FILL HERE: Print the student status using System.out.println (format: "Is Student: true") - - - // Data type demonstration - System.out.println("\n=== Data Type Information ==="); - - // FILL HERE: Print the data type of age variable (hint: use "int") - - // FILL HERE: Print the data type of height variable (hint: use "double") - - // FILL HERE: Print the data type of grade variable (hint: use "char") - - // FILL HERE: Print the data type of isStudent variable (hint: use "boolean") - - // FILL HERE: Print the data type of name variable (hint: use "String") + System.out.println("Name: " + n); + System.out.println("Age: " + a); + System.out.println("Height: " + h + " feet"); + System.out.println("Grade: " + g); + System.out.println("Is Student: " + isStudent); + + System.out.println(); + System.out.println("=== Data Type Information ==="); + System.out.println("age is of type: int"); + System.out.println("height is of type: double"); + System.out.println("grade is of type: char"); + System.out.println("isStudent is of type: boolean"); + System.out.println("name is of type: String"); } -} \ No newline at end of file +} +