변수형 boolean을 사용한 간단한 예제입니다.

 

 

Java  의 자료형중 하나인 boolean 을 사용하는 간단한 예제 입니다.

 

*** 원본설명

 

Vboolean.java


/*
* boolean is simple Java type which can have only of two values; true or false.

* All rational expressions retrun this type of value. 
*
* Declare boolean varibale as below
* 
* boolean = ;
* 
* here assigning default value is optional.
*/

 

*** 소스

 

package com.redjava.java.variable;

public class Vboolean {
 
    public static void main(String[] args) {

 

        boolean b1 = true;
        boolean b2 = false;
       
        boolean b3 = (10 > 2)? true:false;

        System.out.println("Value of boolean variable b1 is :" + b1);
        System.out.println("Value of boolean variable b2 is :" + b2);
        System.out.println("Value of boolean variable b3 is :" + b3);           


    } 

}

 

 

*** 결과

Value of boolean variable b1 is :true
Value of boolean variable b2 is :false
Value of boolean variable b3 is :true

 

 

 

블로그 이미지

슬픈외로움

개발이 어려워? 모든것엔 답이있다...

,