1/*
2 Java Data Types
3There 2 Types Of Data Types In Java
41) Primitive -> byte, char, short, int, long, float, double and boolean.
52) Non-primitive -> (All Classes) -> String, Arrays etc.
6
7Type Size Stores
8byte 1 byte whole numbers from -128 to 127
9short 2 bytes "" -32,768 to 32,767
10int 4 bytes "" -2,147,483,648 to 2,147,483,647
11long 8 bytes ""-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
12float 4 bytes fractional numbers; for storing 6 to 7 decimal digits
13double 8 bytes fractional numbers; "" 15 ""
14boolean 1 bit true or false values
15char 2 bytes single character/letter or ASCII values
16*/
1<?php
2/*
3Variables can store data of different types, and different data types can do different things.
4
5PHP supports the following data types:
6
71) String
82) Integer
93) Float (floating point numbers - also called double)
104) Boolean
115) Array
126) Object
137) NULL
148) Resource
15*/
16
17// PHP String
18$x = "Hello world!";
19echo $x;
20
21//PHP Integer
22$x = 5985;
23var_dump($x);
24
25//PHP Float
26$x = 10.365;
27var_dump($x);
28
29//PHP Boolean
30$x = true;
31$y = false;
32
33//PHP Array
34$cars = array("Volvo","BMW","Toyota");
35var_dump($cars);
36
37//PHP Object
38 class Car {
39 function Car() {
40 $this->model = "VW";
41 }
42 }
43
44 // create an object
45 $herbie = new Car();
46
47 // show object properties
48 echo $herbie->model;
49
50//PHP NULL Value
51$x = "Hello world!";
52$x = null;
53var_dump($x);
54?>
1/*JavaScript data types*/
2//string
3var string = 'ASCII text';
4//int
5var integer = 123456789;
6//float
7var float = 123.456;
8//boolean, can be true or false
9var t = true;
10var f = false;
11//undefined
12var undef;//defaults to undefined
13var undef = undefined;//not common, use null
14//null
15var nul = null;
16//array
17var arr = ['Hello','my','name','is','Dr.Hippo',123,null];
18//object
19var person = {'name':'John Smith','age':27};
20//function
21var fun = function(){
22 return 42;
23}
1Primitive types are the most basic data types available within the Java language. There are 8: boolean , byte , char , short , int , long , float and double . These types serve as the building blocks of data manipulation in Java. Such types serve only one purpose — containing pure, simple values of a kind.
1Class Node {
2
3Node next = null;
4int data;
5
6public Node(int d){ data = d; }
7
8void append(int d)
9 {
10 blah blah blah
11 ..............
12 }
13}