Vous êtes sur la page 1sur 19

OBJECT ORIENTED

PROGRAMMING
TODAYS COVERAGE
Friend Function/Class
Introduction to Java Programming
FRIEND
FRIEND IS..
That one function/class that makes an object
un-encapsulated
It allows a function/class to access all
members of an object
disregarding its visibility

FRIEND FUNCTION/CLASS
Class A
- int A
# char C
+ float B
+ A()
+ void getA()
- void rewriteC()
# float subtractB()
friend void IcanAccessAll()
void IcanAccessAll()
{
A MyA;

A.
}
friend class is very similar to friend function. Except that Class A in the example become
an attribute in friend-ed class
ASSIGNMENT
Write a paper about
Definition
Implementation structure
Strength and weaknesses
Implementation example
of friend function and classes
Min. 3 pages
A4 paper, default margin
spacing 1,5.
Font 11/12
due next week
THE JAVA PROGRAMMING
LANGUAGE
JAVA: HISTORY
Initiated in 1991 as Project Green by Sun
corporation. Members: James Gosling, Patrick
Naughton, Mike Sheridan

The goal was never lets take on C++, but to build a system
that would let us do a large, distributed, heterogeneous
network of consumer electronic devices all talking to each
other
- Gosling

JAVA: HISTORY
The group introduces Oak OS in 1992.
Based on C++ : Sun want it object oriented.
a PDA OS (star7)
intention: to be used on intelligent devices
1995: Oak --> Java
re-focusing on the internet
running in Netscape browser
Open Sourced in 2006
under General Public License
BROWSING THE NET: BEFORE JAVA
clip art src:
http://nanobitwallpaper.com/wp-content/uploads/computer-clipart-black-and-white.png
http://ospublish.constantvzw.org/blog/wp-content/uploads/clipart_complet.png
Lorem ipsum dolor sit
amet, consectetur
adipiscing elit. Sed ac.
BROWSING THE NET: WITH JAVA
clip art src:
http://nanobitwallpaper.com/wp-content/uploads/computer-clipart-black-and-white.png
http://ospublish.constantvzw.org/blog/wp-content/uploads/clipart_complet.png
Lorem ipsum dolor sit
amet, consectetur
adipiscing elit. Sed ac.
java.util.Date =
java.text.DateForm
at.getDateInstance
().parse(date
String);
JAVA: WORA
Write once, run anywere
Virtual machine translates byte code
to native Windows code and the
Applet is run
JAVA: WORA
Write once, run anywere
Virtual machine translates byte code
to native MacOS code and the Applet
is run
COMPILER VS INTERPRETER
Compiler Interpreter: on java
PROGRAM
windows
compiler
MacOS
compiler
NIX
compiler
.exe .dmg
.bin
JAVA
PROGRAM
Java
compiler
.class
interpreter
OS Machine
language
JAVA: CHARACTERISTICS
Simple
Object Oriented
Easy Distribution
Interpreter
Robust

JAVA: CHARACTERISTICS
Safe
Architecture neutral
Portable
Performance
Multi-thread
JAVA: IDE
Eclipse
NetBeans --> were going to use this.
JDeveloper
etc.

you can also run Java compiler on
terminal/command prompt
JAVA IDE: NETBEANS
Download for free at: https://netbeans.org/
Any 7
th
version will be ok.
latest 7
th
version release:
https://netbeans.org/downloads/7.4/
the newest is 8
th
, but the Java version it requires
only supports 64bits.
JAVA: HELLO WORLD
public class Example1
{
public static void main(String[] args){
System.out.print(Hello World);
}
}

Vous aimerez peut-être aussi