Java Mock interview questions

Source: Internet
Author: User
Tags bitwise bitwise operators case statement float double

Java four class eight basic data types

First class: integer byte short int long

Type II: float float double

Type III: Logical Boolean (evaluates to true false)

Class Fourth: Character Char

The & operator.

| or a bitwise operator in Java, the binary is evaluated, two bits are 1 returns 1, otherwise 0 is returned.

^ XOR or bitwise operators in Java, the binary is calculated, two bits different return 1, otherwise return 0.

= = can be used to compare reference types ( compared to virtual addresses ) or to compare basic data types ( compared to binary). It is important to note that the base data type can be compared to the wrapper type. Returns true as long as the value is the same. Int=10 and double=10.0 return True.

The Witch statement has the following rules: (1) The variable type in the switch statement can only be a byte, short, int, or char. (2) When the value of a variable is equal to the value of the case statement, execution starts from the statement after the case statement, and the switch statement is not popped out until the break statement appears. A switch statement can contain a default branch, which must be the last branch of a switch statement. (3) default is executed when no case statement is equal to the value of the variable. The default branch does not require a break statement.

Break is used to interrupt the loop statement, and continue is used to continue the loop. Breake break out of the loop body, continue continue the next loop, but the statement after continue is not running. Continue can only be used in loop statements, and break may be used in other branches.

In the Java language, when a value is passed, the basic data type is passed as a value, but the value is copied to the formal parameter, and the modification of its parameters is not affected.

A reference type passes a virtual address.

Java Mock interview questions

Related Article

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.