0% found this document useful (0 votes)
54 views

Computer Programming 1 NCII Notes and Lesson Summary

Student-sourced lecture materials and curriculum review for 11th grade students in their 1st semester, 2nd quarter course in Computer Programming I

Uploaded by

Jaye Carreon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Computer Programming 1 NCII Notes and Lesson Summary

Student-sourced lecture materials and curriculum review for 11th grade students in their 1st semester, 2nd quarter course in Computer Programming I

Uploaded by

Jaye Carreon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Programming I Java Runtime Environment (JRE):

Quarter II - Notes & Reviewer JDK includes JRE. JRE installation on our computers
allows the java program to run, however, we cannot
Lesson 6-7: Conversions compile it. JRE includes a browser, JVM, applet supports,
and plugins. For running the java program, a computer
needs JRE.
Refer to notebook notes
Garbage Collector:
Lesson 8: Introduction to Java Programming In Java, programmers can’t delete the objects. To delete
or recollect that memory JVM has a program called
Java is an object-oriented, concurrent Garbage Collector. Garbage Collectors can recollect the
language. It is an all-purpose language that is objects that are not referenced. So Java makes the life of
class-based and runs on any platform and with as a programmer easy by handling memory management.
few dependencies as possible. However, programmers should be careful about their
code whether they are using objects that have been
Developer of Java used for a long time. Because Garbage cannot recover
- James Gosling the memory of objects being referenced.
- Along with Colleagues at Sun Microsystems
ClassPath:
Timeline of Java Development The classpath is the file path where the java runtime
1990 - Creation (Alpha stages) and Java compiler look for .class files to load. By default,
1995 - Java 1.0 Public Release JDK provides many libraries. If you want to include
external libraries they should be added to the classpath.
Complete History of Java
1. Java was originally developed by James Gosling Object-Oriented Programming (OOP) Language:
with his colleagues at Sun Microsystems during Organizing the program in the terms of collection of
the early 1990s. objects is a way of object-oriented programming, each
of which represents an instance of the class.
2. Initially, it was called a project ‘Oak’ which had
implementation similar to C and C++. The four main concepts of OOP:
3. The name Java has later selected after enough ● Abstraction
brainstorming and is based on the name of an ● Encapsulation
espresso bean. ● Inheritance
● Polymorphism
4. Java 1.0, the first version was released in 1995
with the tagline of ‘write once, run anywhere’. Lesson 9: Creating Executable Java Applications
Later, Sun Microsystems was acquired by Oracle.
Getting Started in Netbeans:
5. Java became one of the programming languages 1. Start NetBeans.
with the fastest growing developer base 2. Create a new Java Project:
1. File->New->Project.
Java Terminologies (Terms) 2. Select "Java" in the category list.
Java Virtual Machine (JVM): 3. Select "Java Project" in the project list. Click
This is generally referred to as JVM. There are three "Next".
execution phases of a program. They are written, 4. Enter a project name into the Project name
compile and run the program. field, for example, “ICT11-01".
5. Click "Finish"--It will ask you if you want the
Bytecode in the Development process: Java perspective to open. (You do.)
As discussed, the Javac compiler of JDK compiles the 3. Create a new Java class:
java source code into bytecode so that it can be 1. Click the "Create a Java Class" button in the
executed by JVM. It is saved as .class file by the toolbar. (This is the icon below "Run" and
compiler. To view the bytecode, a disassembler like "Window" with a tooltip that says "New Java
javap can be used. Class.")
2. Enter “MyClass" into the Name field.
Java Development Kit (JDK): 3. Click "Finish".
While we were using the term JDK when we learn about
bytecode and JVM. So, as the name suggests, it is a Sample “Print ‘My First Java Program’” Code
complete Java development kit that includes everything
including compiler, Java Runtime Environment (JRE),
java debuggers, java docs, etc. For the program to
execute in java, we need to install JDK on our computer
in order to create, compile and run the java program.
Parts of A Java Program: - “Print”
- Prints a string
Sample Code - Does not advance the cursor to the beginning of
the next line when printing a string

println() Method
- “Print line”
- Prints a string and makes a new line
- Advances the cursor to the beginning of the
next line when printing a string

Program Output: print() & println() escape sequence


run:
I love Programming \n makes a new line
BUILD SUCCESSFUL (total time: X second/s)

Sample Code:
Java Fundamentals System.out.print(“ICT 11-02\n”);
System.out.print(“Has a better schedule than ICT01\n”);
Java API Code Sample:
System.out.print(“Prints on same line”);
System.out.println(“Prints another line”);
Code Output:
ICT 11-02
Has a better schedule than ICT01
BUILD SUCCESSFUL (total time: X second/s)

\” makes double quotation marks

Sample Code:
System.out.print(“\”ICT 11-02\””);
System.out.print(“Has a better schedule than ICT01\n”);

Code Output:
‘System’
“ICT 11-02”
Is a class that is part of the Java API. This class contains Has a better schedule than ICT01
methods and objects. One such objects called here is BUILD SUCCESSFUL (total time: X second/s)
‘out’.
Helpful for Code, not Included in Lesson:
‘out’
Out is an object that contains methods. Two such Code Commenting
methods are ‘print’ and ‘println’
/* Sample Comment */
The ‘print’ & ‘println’ methods
/* <- for commenting inline
print Code
*/ <- not necessary, but closes commenting for long
public static void main (String[] args)
{ comments.
System.out.print(“ICT 11-02!”);
}

print Output

ICT 11-02! BUILD SUCCESSFUL (total time:)


println Code

public static void main (String[] args)


{
System.out.println(“ICT 11-02!”);
}

println Output

ICT 11-02!
BUILD SUCCESSFUL (total time:)
print() Method

You might also like