A data type is a set of values and a set of operations defined onthem. For example, us are acquainted with numbers and also with operationsdefined top top them together as enhancement and multiplication.There room eight various built-in types of data inJava, mostly various kinds of numbers.We usage the system form for strings of characters so frequentlythat we also consider the here.

You are watching: Which of the following is the correct expression of character 4?

built-in data typesTerminology.
We usage the adhering to code fragment to introduce some terminology:int a, b, c;a = 1234;b = 99;c = a + b;
The first line is a declaration statement the declaresthe names of 3 variables utilizing the identifiersa, b, and c and their form to be int.The next three lines are assignment statements that readjust thevalues of the variables, making use of the literals 1234 and also 99,and the expression a + b, through the end an outcome that chas the value 1333.Characters and also strings.
A char is one alphanumeric character or symbol, prefer the ones the youtype. Us usually execute not perform any kind of operations on characters otherthan assigning worths to variables. A string is a sequence ofcharacters. The most usual operation that we carry out on strings isknown as concatenation: offered two strings, chain them together tomake a new string. Because that example, think about the complying with Java program fragment:String a, b, c;a = "Hello,";b = " Bob";c = a + b;
The an initial statement declares 3 variables to it is in of kind String.The following three explanation assign values to them, v the end an outcome thatc has actually the worth "Hello, Bob".Using string concatenation,Ruler.java prints the relativelengths the the subdivisions top top a ruler.Integers.
An int is an creature (whole number) between−231 and also 231 − 1 (−2,147,483,648 to 2,147,483,647).We use ints generally not justbecause castle occur generally in the genuine world, but also theynaturally arise when expressing algorithms. Conventional arithmeticoperators for addition, multiplication, and division, because that integers arebuilt right into Java, as shown inIntOps.java and also the following table:int expressionsFloating-point numbers.The twin type is for representing floating-pointnumbers, e.g., for usage in clinical applications.The interior representation is favor scientific notation,so that we deserve to compute with actual numbers in a substantial range.We can specify a floating suggest number using either a cable ofdigits through a decimal point, e.g., 3.14159 because that a six-digitapproximation to the mathematical consistent pi, or witha notation favor scientific notation, e.g., 6.022E23for Avogadro"s continuous 6.022 × 1023.Standard arithmeticoperators because that addition, multiplication, and division, because that doublesare developed in come Java, as shown in DoubleOps.java and the following table:double expressionsQuadratic.java shows the use ofdoubles in computing the two roots the a quadratic equation utilizing thequadratic formula.Booleans.The boolean kind has simply two values:true or false.The obvious simplicity is deceiving—booleans lie at the foundationof computer system science. The most important operators identified for the boolean arefor and, or, and also not.and: a && b is true if both a and b space true, and also false otherwise.or: a || b is true if one of two people a or b is true (or both are true), and also falseotherwisenot: !a is true if a is false, and false otherwise.Although these meanings are intuitive and easy come understand,it is worthwhile to totally specify each possibility for eachoperation in a truth table.boolean operationsComparisons.The comparison operators are mixed-type operations the take operands the one kind (e.g., int or double) and produce a an outcome of type boolean.These operations pat a an important role in the process of developingmore sophisticated programs.comparison operationsLeapYear.java tests whetheran integer corresponds to a leap year in the Gregorian calendar.

Library methods and also APIs.

Many programming work involve using Java library methods in additionto the integrated operators.An application programming interface is a table summarizing the methods in a library. Printing strings to the terminal window.printing to typical output Converting strings come primitive types.parsing command-line arguments Mathematical functions.math libraryYou can call a method by inputting its name complied with by arguments,enclosed in parentheses and separated through commas. Here are some examples:library callsWe often discover ourselves converting data indigenous one kind to anotherusing one of the complying with approaches.

See more: Leave The World A Better Place Than You Found It, Words To Live By

Type conversion.