top of page
Search

JAVA Script Lecture 2

  • Writer: dipeshbakhrel
    dipeshbakhrel
  • Nov 11, 2024
  • 1 min read



Outline

Lecture 1 Review

More types

Methods

Conditionals

Types Kinds of values that can be stored and manipulated. boolean:

Truth value (true or false).

int: Integer (0, 1, -27).

double: Real number (3.14, 1.0, -2.1).

String: Text (“hello world ”, “example”).

Variables

Named location that stores a value

Example:

String c = “c”;

String d = “letter d”; c = “letter c”;

String e = c + “ and “ + d;


Division

Division (“/”) operates differently on integers and on doubles!

Example: double c = 5.0/2.0; // c = 2.5

int d = 4/2; // b = 2

int e = 5/2; // c = 2

double f = 5/2; // f = 2.0

 
 
 

Comments


bottom of page