slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Alpha training center PowerPoint Presentation
Download Presentation
Alpha training center

Alpha training center

136 Views Download Presentation
Download Presentation

Alpha training center

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. java COURSE 401, VitthalComplex,Opp. SakarSchool,New C.G Road,Chandkheda,Ahmedabad-382424. Phone : +91-8866403111 Email Website : Alpha training center

  2. Why Java? • It’s the current “hot” language • It’s almost entirely object-oriented • It has a vast library of predefined objects and operations • It’s more platform independent • this makes it great for Web programming • It’s more secure • It isn’t C++

  3. Applets, Servlets and Applications • An applet is designed to be embedded in a Web page, and run by a browser • Applets run in a sandbox with numerous restrictions; for example, they can’t read files and then use the network • A servlet is designed to be run by a web server • An application is a conventional program B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  4. Java Virtual Machine • The .class files generated by the compiler are not executable binaries • so Java combines compilation and interpretation • Instead, they contain “byte-codes” to be executed by the Java Virtual Machine • other languages have done this, e.g. UCSD Pascal • This approach provides platform independence, and greater security B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  5. HelloWorld (standalone) public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } • Note that String is built in • println is a member function for the System.out class B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  6. Java program layout • A typical Java file looks like: import java.awt.*;import java.util.*; public class SomethingOrOther { // object definitions go here . . .} This must be in a file named !

  7. So, what is a class? • A class consists of • a collection of fields, or variables, very much like the named fields of a struct • all the operations (called methods) that can be performed on those fields • can be instantiated • A class describes objects and operations defined on those objects B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  8. The Java Virtual Machine. Traditionally, source code had to be compiled for the target hardware and OS platform: Windows Compiler i386 binary Solaris Compiler SPARC binary Source.cpp Mac Compiler PPC binary B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  9. Name conventions • Java is case-sensitive; maxval, maxVal, and MaxVal are three different names • Class names begin with a capital letter • All other names begin with a lowercase letter • Subsequent words are capitalized: theBigOne • Underscores are not used in names • These are very strong conventions! B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  10. The Java Virtual Machine. Java source files (.java) are compiled to Java bytecode (.class) Bytecode is interpreted on the target platform within a Java Virtual Machine i386 VM Java Compiler Java Bytecode Source.class SPARC VM PPC VM B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  11. Packages • Like “namespace” in C++ • How to use: • C++: using namespace xxx • Java: import xxx, or import xxx.xx B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  12. 1 <html> 2 <applet code="WelcomeApplet.class" width=300 height=30> 3 </applet> 4 </html> A Simple Java Applet: Drawing a String • appletviewer only understands <applet> tags • Ignores everything else • Minimal browser • Executing the applet • appletviewer WelcomeApplet.html • Perform in directory containing .class file B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173

  13. Where to Get More Information Anything Technologies & Computers : AnythingHR Team B2/6/2 Vashi ,Navi Mumbai, Contact:09892900103/9892900173