Three-object operator in Java

Source: Internet
Author: User

Three-object operator in Java

1. Problem background

The result of the following code is:

A. hai
B, 1987
C, 1988
D. None of the above answers

/*** The Three-object operator * A, hai * B, 1987 * C, 1988 * D, and the above answers are incorrect */package com. you. model;/*** @ author YOUHAIDONG **/public class YesNo {/*** @ param args */public static void main (String [] args) {// declare an integer variable youint you = 56; // string strString str = (you <50 )? "Hai" :( you> 60 )? "1987": "1988"; // print strSystem. out. println (str );}}

2. Problem Analysis

(1) Since the variable you is 56, 56 is greater than 50, and false, yes: (you> 60 )? 1987: 1988"

(2) If 56 is less than 60, the value is false. Select 1988.


3. Answer

1988

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.