Internet and Java Foundations, Programming and Practice
10% ofMarket
20% ofMarket
TotalMarket
The web server sends the hypermedia HTML documents to the client.You end up seeing the document on your screen
How does the Web Work
* Broadcast capability - publish once, reach millions
Buzzword compliant!
(one for each different system)
?
Java Environment/Life Cycle of Java Code
2
3
1
5
Create Applettag in HTMLdocument
Accessing fromCRAY Corp.(USA)
The browser createsa new window and a new thread and then runs the code
India
must be used with a constructorclass Weight { int lb, oz; public Weight (int a, int b) { lb = a; oz = b; } } public Weight (int x) { this( x, 0); }}
Constructor is also overloaded (Java allows overloading of all methods, including constructors)
Inheritance and Constructors
First class Second class Third class
Topmost class constructor is invoked first (like us …grandparent-->parent-->child->)
code with exceptions:...int a = 7, b = 0, result;try { result = a/b;}catch (ArithmeticException e ) { System.out.println(“b is zero”);}...
A nice way to handle errors in Java programs
class MyException extends ArithmeticException {}frm
Frame
1) mouseDragged(MouseEvent) - Invoked when a mouse button is pressed on a component and then dragged. 2) mouseMoved(MouseEvent) - Invoked when the mouse button has been moved on a component (with no buttons down).
For example, the MouseMotionListener interface has two methods:
... the WindowListener interface has seven methods:
Therefore, cannot do new WindowListener();
Instead, have to subclass the interface and then create object of the subclass
class MyApp implements ActionListener { Button b = new Button(“OK”); public static void main(String [] s ) { (new MyApp()).go(); } public void go() { b.addActionListener( this ); } public void actionPerformed(ActionEvent e ) { // what to do when the button is clicked if( e.getSource() == b ) { System.out.println(“OK pressed"); } }}
Implementing 2 interfaces
Need only implement the method(s) that are required, instead of all seven methods of the WindowListener interface
I.e., cannot have :
class MyApp extends WindowAdapter, MouseAdapter, ... { … … … ...}
· appletviewer MyApplet.html (or open MyApplet.html in browsers like Netscape/IE).
AppletContext“Applet” derived from AWT PanelHooks into Browser environmentCan be used to link to another Web page
threads are light-weight processes within a process
so
writer(){- - - - - - - - - -lock(buff[i]);write(src,buff[i]);unlock(buff[i]);- - - - - - - - - -}
buff[0]
buff[1]
Cooperative Parallel Synchronized Threads
Echo Server ...
Echo Server
Java Standard Extension APIJava Standard Extension Classes
The JavaBasePlatform(in black)
Network
Java ona Browser
Java on aDesktop OS
Java on aSmaller OS
Java on JavaOS
Если не удалось найти и скачать презентацию, Вы можете заказать его на нашем сайте. Мы постараемся найти нужный Вам материал и отправим по электронной почте. Не стесняйтесь обращаться к нам, если у вас возникли вопросы или пожелания:
Email: Нажмите что бы посмотреть
Это сайт презентаций, докладов, проектов, шаблонов в формате PowerPoint. Мы помогаем школьникам, студентам, учителям, преподавателям хранить и обмениваться учебными материалами с другими пользователями.
Для правообладателей