GoConqr has a new look! Let us know what you think.

Notes

Java- Data terms

mamoun diab English 3 pages

Content of the notes (3)

Page 1

int is short for integer, which are all positive and negative numbers, including zero. This number could represent the number of visits a website has received or the number of programming languages you know.

A Boolean is a data type that can only be either true or false.

The char data type is used to represent single characters. That includes the keys on a keyboard that are used to produce text.

Whitespace is often used to make code visually presentable

(Makes Code look neat)

In Java, there are two styles of comments: single line comments and multi-line comments.

Single line comments are one line comments that begin with two forward slashes

// I'm a single line comment!

Multi-line comments are generally longer comments that can span multiple lines. They begin with /* and end with */ . Here's an example:

/*

Hello,

Java!

*/ Multi-line comments are generally longer comments that can span multiple lines. They begin with /* and end with */ . Here's an example:

/* Hello,

Java! */

Page 2

The modulo operator - represented in Java by the % symbol

Relational operators compare data types that have a defined ordering

Examples

Here are a few relational operators:

< : less than.

<=: less than or equal to.

>: greater than.

>=: greater than or equal to.

System.out.println(5 < 7);

The equality operators are:

==: equal to.

!=: not equal to.

Boolean operators

There are three operators

1. The and operator is represented in Java by &&.

(It returns a boolean value of true only when the expressions on both sides of && are true. )

Example:

// The following expression uses the "and" Boolean operator

System.out.println(true && true); // prints true

System.out.println(false && false); // prints false

System.out.println(false && true); // prints false

System.out.println(true && false); // prints false

2. The or operator is represented in Java by ||.

It returns a Boolean value of true when at least one expression on either side of || is true.

example:

System.out.println(false || false); // prints false

System.out.println(false || true); // prints true

System.out.println(true || false); // prints true

System.out.println(true || true); // prints true

Page 3

Information

Description
Computer Science- Java langue
Created by
mamoun diab
Views
7
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?