Lec 26 Java Fundamental of Computing
Lec 26 Java Fundamental of Computing
• 8 Primitive Types
– byte, short, int, long
– float, double
– boolean
– Char
• Object types:
– predefined e.g. “String” ;
– User-defined – via “class” and constructors
double number = 3;
Array Syntax
double[ ] number;
Array Syntax
• double average = 0;
• for (i=0; i<7; i++)
• { average += dailyRainFall[i]; }
• average /= 7;
BUT: What if we wish to sort the marks? How can we maintain the roll numbers
etc?
Student records
rollNum= {6016, 6024, 6078};
midsemMarks = {61.7, 54 , 74.2 };
name = {"Abhishek Murthy",
"AbhishekS",
"Ankit"};