Types of Output in Java Programming

Types of Output in Java Programming, Value bases Result in Java, Boolean Result in Java, Constant based Result in Java, and Dynamic Result in Java.

Java Input and Output Operations

  • Read user input
  • Read data from files
  • Write program output on the console
  • Write data or output in files

Types of Output/Result in Java

The Output of Computer Programming (not only in Java) basically four types,

1) Value-based Result (Fixed)
2) Boolean / Logical Result (true/false)
3) Constant based Result
4) Dynamic Result

1. Value-based Result (Fixed)

Arithmetic Operators and some predefined methods return this type of Value-based Result.

Example:
System.out.println(10+3);//13
System.out.println(5*6); //30

System.out.println(Math.max(10, 7));//10

2. Boolean / Logical Result (true/false)

Relational / Comparison Operators return Boolean Results, and some predefined methods return this type of Result

Example:

System.out.println(100<99);//false
System.out.println(100>99);//true

System.out.println(“ABC”.equals(“abc”));//false
System.out.println(“JAVA”.equals(“JAVA”));//true

3. Constant based Result (Output)

Java Returns Constant based Result in 3-way comparison of Numbers

Result Criteria,
i) if number1 < number2 then -1
ii) if number1 = number2 then 0
iii) if number1 > number2 then 1
———-
Example:

int a=7;
Integer x=a;

System.out.println(x.compareTo(9));//-1
System.out.println(x.compareTo(7));//0
System.out.println(x.compareTo(4));//1

4. Dynamic Results (Output)

i) Generating Random Numbers…
ii) Returning system Date….
———————
Example:
//Generate Random Number
System.out.println(Math.random());

//Return System date
Date date = new Date();
System.out.println(date);


Java Step by Step Tutorial

Java Videos

Java Language Syllabus

1. Introduction to Java Programming

2. Java Installation and Environment Setup

3. Java Keywords and Identifiers

4. Java Basic Syntax

5. Java Program Structure

6. Comments in Java

7. Access and Non Access Modifiers in Java

8. Java Data Types

9. Java Variables

10. Java Operators

11. Java Decision Making Statements

12. Java Loop Statements

13. Java Branching Statements

14. Java Strings

15. Arrays in Java

16. Java ArrayList

17. Java Read User Input

18. File Handling in Java

19. Java User Defined Methods

20. Java Built-in Methods

21. Exception Handling in Java

22. Java Object-Oriented Programming

23. Java Inheritance

24. Polymorphism in Java

25. Abstraction in Java

Follow me on social media:

Leave a Comment