Java Quiz 1
reference
Operation‐centered User‐defined Accessed through reference variables
primitive
Value‐centered Predefined Accessed through variables
how do you change a variable from primitive to references with a wrapper class?
"new" Integer rf1 = new Integer("1");
What are the two ways of commenting while coding?
// short comments /* long comment */
= vs ==; How they differ
== is a realtional operator, means equal to = is an assignment compound ?
Objects vs classes
Objects are everything around us, physical or abstract, each characterized by attributes and behaviors/operations; Objects sharing common characteristics are organized and "classified" into a class. While an object is an individual design, a class is an abstraction /model/ blueprint which captures the common behaviors of a set of objects and define a new abstract data type.
what's wrong with this code: two things System.println("Hello world!")
System.out.println("Hello world!") ; out and semi colon
What is a specification in writing a Java code?
a problem / task, should be clear and feasible with no doubt/ ambiguity
integral 5 types
char, byte, short, int, long
Compiler vs assembler
compiler: translates an entire program before executing it
What is an operator in Java?
does the operation, does something to the variable
floating point 2 types
float and double
High-level language vs machine language
high level langauage = what we write in to programs like java machine langauage = binary
What language does a computer understand?
high-level (compiler) assembly (assembler) machine (machine interpreatation) hardware architecture (architecture implementation) logic circuit
Naming rule for identifiers and variables in Java
identifiers: case-senstitve, self-explanatory, letters, digits, _ $, can't start with digit, can't be reserved word
What is a pseudocode?
mixture of english and programming language
What is String in terms of its data type? Is it a primitive data type or not?
predefined (like primitive), but not a primitive data type
Wrapper classes transform _____ into objects
primitive data type
What is the escape character for?
punctuation, new line, tab, quotation
how to get things to go to the command prompt
reference data! public class NameOfFile { public static void main(String[] args) { ...
What is an algorithm?
set of programmable instructions to solve a problem
Attributes
store data that characterizes an object, and they are represented by variables associated with the state of the object.
Boolean
true/false
What is the keyword to create an object by calling a class through a reference variable?
wrapper class???
What are wrapper classes in Java?
wrapper classes transform primitive data types into objects
Advantages of Java over other programming languages
‐ simple and easy to learn(?) ‐ platform portability; write once, run everywhere with JVM ‐ code reusability; once write, use everywhere ‐ extreme security; no viruses attack the host system ‐ extreme reliability, making it possible to develop Web applications ‐ supports multi‐threading, making software development easy ‐ supports Unicode, making people work with non‐English languages ‐ extreme versatility; Java is everywhere! ‐ supports object‐oriented programming (OOP)