Sie sind auf Seite 1von 1

DDOCP: Level 4

Topic 01
What is a computer program? String device = "iPhone";
 A computer program is a list of instructions that tell a System.out.print( device.length() );
computer what to do. Everything done on a computer is → Output: 6
done by using a computer program.  toUpperCase() method
 A computer program is stored as a file on the computer's → Converts all of the characters in this String to upper
hard drive. When the user runs the program, the file is case.
read by the computer, and the processor reads the → Signature: String toUpperCase()
data in the file as a list of commands or instructions. Then → Example
the computer does what the program tells it to do. String name = "Habib";
 § A computer program is written by a programmer. It is System.out.print( name.toUpperCase() );
very difficult to write in ones and zeroes, which is what → Output: HABIB.
the computer can read, so computer programmers write
in a programming language. Once it is written, the
programmer uses a compiler to turn it into a language
that the computer can understand.
Advantages for the programmer of the
context sensitive editor?
 Every Programming Language has strict syntaxes to
code instructions. Most of them are case-sensitive.
 Though a simple text editor like notepad is enough to
write programs, but context sensitive code editors in IDE
can increase programmer’s productivity.
→ Context sensitive editors offer number of features
→ Keyword highlights makes source code readable
→ Grouping, indentation do the same
→ Auto-completion saves key stoke
→ IntelliSense- suggestion of possible commands
makes coding easier
→ Error highlighting allows finding syntax errors easier.
What is meant by a Class in the Java
programming language?
 A class blueprint or design specification of a certain type
of software objects.
 A class is a template for an object.
 A class defines what information an object will hold and
what an object can do at runtime.
 An object is created according to its class, hold
information according to the structure defined in its class
and behaves according to its class.
Differences between an object and a
class.
 § A class is a template for an object but an object is an
instance of a class.
 § A class defines properties and behaviors of an object,
but an object stores data in property values and
functions according its behaviors designed in the class.
 § A class is only the design but the object is runtime
entity, it functions in our program.
How variables are declared in a Java?
 § Java is a strongly typed programming language. This
means that every variable must have a data type
associated with it.
 § To declare a variable in Java, all that is needed is the
data type followed by the variable name:
int numberOfStudents;
→ In the above example, a variable called
"numberOfStudents" has been declared with a data
type of int.
Two methods of String class?
 length() method
→ This method returns the length of this string. The
length is equal to the number of 16-bit Unicode
characters in the string.
→ Signature: int length()
→ Example.

Das könnte Ihnen auch gefallen