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);
1. Introduction to Java Programming
2. Java Installation and Environment Setup
3. Java Keywords and Identifiers
7. Access and Non Access Modifiers in Java
11. Java Decision Making Statements
21. Exception Handling in Java
22. Java Object-Oriented Programming
Follow me on social media: