Example 1: all data types in java
Data Type Size Stores
byte 1 byte whole numbers from -128 to 127
short 2 bytes whole numbers from -32,768 to 32,767
int 4 bytes whole numbers from -2,147,483,648 to 2,147,483,647
long 8 bytes whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float 4 bytes fractional numbers; sufficient for storing 6 to 7 decimal digits
double 8 bytes fractional numbers; sufficient for storing 15 decimal digits
boolean 1 bit true or false values
char 2 bytes single character/letter or ASCII values
Example 2: data types in javascript
//String Data Type
var strSingle = 'John'; //String with single quotes
var strDouble = "Bob"; //String with double quotes
//Number Data Type
var num = 25; //Integer
var flo = 80.5; //Floating-point number
var exp = 4.25e+6; //Exponential notation, this equates to 4250000
//Boolean Data Type
var isReading = true; //Yes, I'm reading
var isSleeping = false; //No, I'm not sleeping
//Undefined Data Type
var undef; //If a value is never assigned, any output will be 'undefined'
//Null Data Type
var noValue = null; //Null meaning that it is has no value, not the same as 0 or ""
//Object Data Type
var emptyObject = {};
var person = {"name": "Clark", "surname": "Kent", "age": "36"}; //The quotes around the propety name can be omitted if the property name is a valid JS name
var car = { //Same as person but easier to read
model: "BMW X3", //Example with quotes around property name ommitted
color: "white",
doors: 5
}
//Array Data Type
var emptyArray = []; //An array can be of any data types (string, number, boolean, etc.)
var array = ["One", "Two"] //String array, note the index of the first element is 0
//Function Data Type
var func = function() { //Calling the function: func();
alert("Code excuted"); //Outputs: Code executed
}
var funcVar = function(amount) { //Calling the function: funcVar(6);
alert("Code excuted " + amount + " times"); //Outputs: Code executed 6 times (if input was 6)
}
//Typeof Operator
typeof variable; //Returns the data type of the variable
Example 3: python data types
#use syntax: variable = value
#string
string = 'ASCII text'
#integer
integer = 1234567890
#float
floatnum = 123.456
#list(called arrays in other languages)
numlist = [1,2,3,4,5]
#dictionary(called objects in other languages)
dictionary = {'key','value'}
Example 4: what is primitive data type in java
Primitive 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.
Example 5: what are the data types
class Output {
public static void main(String args[])
int a = 1;
int b = 2;
int C;
int d;
C = ++b;
d = a++;
C++;
b++;
++a;
System.out.println(a + " " + b + " " + c);
}
}
Pick ONE option
324
323
234
Example 6: python data types
Text Type: str
Numeric Types: int, float, complex
Sequence Types: list, tuple, range
Mapping Type: dict
Set Types: set, frozenset
Boolean Type: bool
Binary Types: bytes, bytearray, memoryview