SlideShare una empresa de Scribd logo
1 de 59
Descargar para leer sin conexión
Java Technicalities
                          From a C/C++ Programmer’s View


                                             yen3

          Dept. of Computer Science and Information Engineering, Chang Gung University


                                       April 15, 2009




                                                             .     .     .    .     .    .

Java Technicalities                                                                      1/58
Introduction   About




  About Author
        Computer Science Student
        Blog: No title, no thinking, no meaning
        E-mail: yen3rc    gmail


        C, C++, Java, Haskell, LTEX
                               A




                                                         .   .   .   .   .   .

Java Technicalities                                                          2/58
Introduction   Outline


Introduction
    About
    Introduction
Technicalities
   Type
   Class and Object
   Generic in Java (igonred)
   Exception
Library and Programming
    String
    Container and HashTable
    Java I/O
    JDBC — Java Database Connectivity
Conclusion
   Conclusion
   Reference                                        .   .   .   .   .   .

Java Technicalities                                                     3/58
Introduction   Outline




  About Slide



                  Josh Ko (Joshsoft)
          XD
          The slide is made by XELTEX and Beamer. XD
                                 A

          The Color Theme designed by Josh Ko uses Oxford brand colors1 .




     1
         http://www.ox.ac.uk/staff/branding toolkit/the brand colours/index.html
                                                           .     .    .     .     .   .

Java Technicalities                                                                   4/58
Introduction   Outline




  Something About Guang-Wu Chen’s Requirement
He hopes you understand the following topics.
        String (all kinds of string/character processing stuff)
        StringTokenizer
        Hashtable (or other containers such as Vector, etc.)
        JDBC related ones, including Connector, Statement, ResultSet.
        I/O classes, of course.




                                                           .   .   .   .   .   .

Java Technicalities                                                            5/58
Introduction   Introduction




  But ...
                                                  XD
                      XD




                                                         .   .   .   .   .   .

Java Technicalities                                                          6/58
Introduction   Introduction




  But ...
                                                  XD
                      XD

Josh Ko and yen3’s Talking
yen3:     Java                            ...Orz
Josh Ko: XD
yen3:                 Java  Functional Programming                       XD
Josh Ko:       , Java    OO   XD




                                                         .   .   .   .        .   .

Java Technicalities                                                               6/58
Introduction   Introduction




                      Everything is an Object.
                             Thinking in Java 4/e




                                                            .   .   .   .   .   .

Java Technicalities                                                             7/58
Introduction   Introduction




  Programming
By Compiler
        Compiled Programming language
        Interpreted Programming language (Script Programming Language)
By Machine
        Imperative Programming (Turing Machine)
        Functional Programming (λ-calculus)
By Model
        Procedural Programming
        Object-Based Programming (Abstract Data Type)
        Object-Oriented Programming
        Generic Programming
                                                            .   .   .   .   .   .

Java Technicalities                                                             8/58
Introduction   Introduction




  TIOBE Programming Community Index for March 2009




                                                    .   .   .   .   .   .

Java Technicalities                                                     9/58
Introduction   Introduction




  About Java
        James Gosling, 1995, Sun Microsystems
        a pure Object-Oriented Programming Language
        Everything is an object.
        Java Virtual Machine and Just-In-Time Compiler XD
        Java SE, Java EE, Java ME
        The language has already been developed for over 10 years and
        become a complete programming language.
        So, What do we know from Java ?




                                                                 .   .   .   .   .   .

Java Technicalities                                                                  10/58
Technicalities   Type




  Type
Java has two different types.
        primitive type: int, char, double, balabala
        pointer type: class type(user-defined type)
We know that Java doesn’t have “pointers”
        Java has “new”, but no “delete” keyword.
        What is Garbage Collection?
        What is Java’s memory management mechanism? (It’s an important
        factor about Java’s program efficiency.)




                                                        .   .   .   .   .   .

Java Technicalities                                                         11/58
Technicalities   Type




  String Type
         String has build-in type’s interface with pointer type’s
         implementation.
         String vs. StringBuffer2
         What does the language do in background?
         Let’s talk about an example.




     2
    In Java, StringBuilder provides an API compatible with StringBuffer, but with no
guarantee of synchronization.                         .    .     .   .     .     .

Java Technicalities                                                            12/58
Technicalities   Type




  Type-Casting
        Java is strongly-typed programming language.
        void* vs. java.lang.Object
        In Java, every class inherits from java.lang.Object. It means we
        can cast an object to java.lang.Object type and cast again to
        other arbitrary class type .
        Compiler doesn’t check the situation because it seems legal from the
        syntactical perspective.
        You have to check the situation by yourself.




                                                       .   .   .   .   .   .

Java Technicalities                                                        13/58
Technicalities   Class and Object




  Thinking about The Problems
          What is a “type”? A Type just like requirement.3 (in Functional
          Programming)
          What is a “object”?
          OO is claimed to be closer to human thoughts. However, is it true ?
          Object vs java.lang.Object
          Why doesn’t Java support “Operator Overloading”?
          “Operator Overloading is syntax sugar. You don’t know how efficient
          you cost in using.”




     3
         Think about “Rules”                                        .   .   .   .   .   .

Java Technicalities                                                                     14/58
Technicalities   Class and Object




  Class and Object
A Class has ...
        data member (Data) – Record States
        member function(Method)
A Class has three modes
        public – interface
        private – implements
        protected – for some reasons XD
We have to pay attention to two keywords, but the slide doesn’t mention.
        static
        final

                                                                   .   .   .   .   .   .

Java Technicalities                                                                    15/58
Technicalities   Class and Object




  Class
There are several kinds of classes.
        Normal Class – There’s nothing to say. XD
        Interface – Think about multiple-inheritance.
        anonymous Class – Think about the relationship about function
        pointer and call-back function.




                                                                   .   .   .   .   .   .

Java Technicalities                                                                    16/58
Technicalities   Class and Object




  Back to C — Function Pointer
        Von Neumann’s Model says program can be saved in memory.
        If we ruled the function’s interface, we can show difference
        functionality by replacing functions rely on function pointer.

For Example: C’ stdlib.h — qsort() protype

void qsort(void* base, size_t n, size_t size,
           int (*cmp)(const void*, const void*));
                          /* function pointer */




                                                                    .   .   .   .   .   .

Java Technicalities                                                                     17/58
Technicalities   Class and Object




  Back to C++ — Function Object
        The most difference between Function Object and Function Pointer is
        Function Object has own states(variable).
        Implementation: Class with Operator Overloading “()”
        If we implemented function object with template. It stars the Generic
        Programming’s first step.

For Example: C++ — Function Object

template<typename T> class Less{
public:
     bool operator()(const T& x, const T& y){ return x < y;}
}


                                                                   .   .   .   .   .   .

Java Technicalities                                                                    18/58
Technicalities   Class and Object




  λ Function (Lambda Function)
        base on lambda-expressions from Functional Programming,.
        no side-effect function.
        an unnamed function for temporary uses
        Haskell n´ive support
                 a
        C++’s support: Boost::lambda

For Example: C++ — Boost::lambda

std::sort(v.begin(), v.end(),
     std::greater<iterator_traits(v.begin())::value_type>());
std::sort(v.begin(), v.end(), *_1 > *_2);


                                                                      .   .   .   .   .   .

Java Technicalities                                                                       19/58
Technicalities   Class and Object




  Call-Back Function — Anonymous Class with Interface
        What is “Call-Back Function”?
        How does JavaScript support the Call-Back Function?
        Class-Based vs Prototype-Based
        Java uses anonymous class and interface(Runnable) to support
        call-back property.

For Example: Java — anonymous class with interface

Thread newTask = new Thread(new Runnable(){
   public void run(){ System.out.println("Hello World!"); }});



                                                                  .   .   .   .   .   .

Java Technicalities                                                                   20/58
Technicalities   Class and Object




  Interface and Abstract Class
        interface and abstract are keywords.
        Interface and abstract classes provide a more structured way to
        separate interface from implementation.
        In begin, we always have no idea to use them.
        It’s show time to use “Refactoring”.
        We can extract to super class, abstract class, or interface from the
        same functionality classes.
        Button-Up Design vs Top-Down Design




                                                                   .   .   .   .   .   .

Java Technicalities                                                                    21/58
Technicalities   Class and Object




  Object-Oriented Class
          For efficient reason, C++ default member function mode is
          non-virtual, but Java is not.
          Please read the relational books to get more details about Java’s
          Class.
          The feature is implemented by function pointer table.
          Think about the relation of RTTI and function pointer table.
          How to Design Class? Traditional OO Design vs eXtreme
          Programming4




     4
         We will discuss the issue next week.                             .   .   .   .   .   .

Java Technicalities                                                                           22/58
Technicalities   Generic in Java (igonred)




  Generic in Java
        Let’s ignore the topic.
        We can discuss the topic if we have a basic knowledge for C++
        Generic Programming.
        C++’s STL is made from some Functional Programming concepts.
        Java’s Generic is made by Java OO method.
        In fact, Java’s Generic is still a OO paradigm.
        You can play the paradigm using Haskell. It’s more interesting than
        C++ and Java. XD




                                                                   .       .   .   .   .   .

Java Technicalities                                                                        23/58
Technicalities   Exception




  Exception
          What is a “Exception”?
          “GOTO Considered Harmful.”5
          Think about the relation between “goto” and “exceptions”.
          We have to know program execute the exception block means low
          efficiency.
          But we couldn’t ignore writing exception when using some library(ex:
          I/O, Socket, Thread)




     5
         Edsger W. Dijkstra, Turing Award 1972                   .   .   .   .   .   .

Java Technicalities                                                                  24/58
Library and Programming




  Library
          Muti-Threading Programming – java.util.concurrent.*
          GUI Programming – javax.swing.*
          Socket Programming – java.net.*
          Generic Container – java.util.* (just for some classes)               6

          I/O – java.io.* (It is a good OO design example.
          balabala
          Don’t forget gwchen’s requirements. XD




     6
         In C++, Generic Container is more interesting than Java.
                                                             .      .   .   .       .   .

Java Technicalities                                                                     25/58
Library and Programming




  How to find Java Document ?
        Please have a book named “Thinking in Java 4/e”. XD
        Google Keyword –
        “your keywords site:http://java.sun.com/javase/6/docs/”
        Eclipse code completes
        Google XD




                                                 .    .   .       .   .   .

Java Technicalities                                                       26/58
Library and Programming   String




  What is a String?
        What is a “char”? What is a “string” ?
        What’s difference between “char array” and “string” ?
        char’s size is 1 byte.
        string’s element is not always using 1 byte for saving information.
        Maybe using 2 bytes, or ...
        Java’s String uses UTF-8 as default encoding.




                                                            .   .   .   .   .   .

Java Technicalities                                                             27/58
Library and Programming   String




  String method

       charAt & indexOf
                                                          isEmpty
       startsWith & endsWith
                                                          getBytes & getChars
       subString
                                                          toCharArray
       contains
                                                          toLowerCase & toUpperCase
       replace & replaceAll &
                                                          format
       replaceFirst
                                                          trim
       matchs




                                                                 .   .   .   .   .    .

Java Technicalities                                                                  28/58
Library and Programming   String




  java.util.StringTokenizer
        http://java.sun.com/javase/6/docs/api/java/util/StringTokenizer.html
        It can break a string into tokens.
        If you want to complexing method for separating string, you can using
        “Regular Expression” and java.lang.String.split().




                                                           .   .   .   .   .   .

Java Technicalities                                                            29/58
Library and Programming   String




  Example: java.util.StringTokenizer

For Example: evaluate the sum of numbers

String s="123 456 789";
StringTokenizer token = new StringTokenizer(s, " ");

int sum=0;
while(token.hasMoreTokens()){
    sum += Integer.parseInt(token.nextToken());
}
System.out.println("The sum is: " + sum + "n");



                                                         .   .   .   .   .   .

Java Technicalities                                                          30/58
Library and Programming   String




  Example: java.lang.String.split()
Attention: the argument using “Regular Expression”.
For Example: evaluate the sum of numbers

String s = "123 456 789";
String[] split = s.split(" ");

int sum=0;
for(int i=0;i<split.length;i++){
    sum += Integer.parseInt(split[i]);
}
System.out.println("The sum is: " + sum + "n");


                                                         .   .   .   .   .   .

Java Technicalities                                                          31/58
Library and Programming   Container and HashTable




  Java Container
        In Java 1.0/1.1, Java uses “Object Container”, but not suggests using
        for now.
        Java uses “Generic Container” instead of “Object Container” in Java
        1.4 and after. Why does Java do?
        Please first consider “Array” unless you have enough reasons to use
        Java Container.
        And you can’t use primitive type in Generic Container, please use
        “type wrapper class” instead of “primitive type”.
For example: type wrapper class

List<int> u = new ArrayList<int>;                                          // wrong
List<Integer> u = new ArrayList<Integer>;                                  // right

                                                                .      .      .   .   .   .

Java Technicalities                                                                       32/58
Library and Programming   Container and HashTable




  Class Hierarchy Tree
        java.util.Arrays
        java.util.Collection<E>
                 java.util.List<E>
                 java.util.Queue<E>
                      java.util.Deque<E>
                 java.util.Set<E>
                      java.util.SortedSet<E>
        java.util.Map<K, V>
                 java.util.SortedMap<K, V>
        java.util.Dictionary<K, V>
                 java.util.Hashtable<K, V>
        java.util.AbstractMap<K, V>
                 java.util.HashMap<K, V>
                      java.util.LinkedHashMap<K, V>
                 java.util.TreeMap<K, V>
                                                                      .      .   .   .   .   .

Java Technicalities                                                                          33/58
Library and Programming   Container and HashTable




  Vector — java.util.List<E>
        java.util.List<E> is an interface class.
        The Most frequently using List is java.util.List.ArrayList
        In interface, like C++’s std::vector<typename T>
                 add() vs. push back()
                 get() vs. operator[]
                 size() vs. size()
        Although “Vector<E>” can be used, but Java’s doc suggests using
        “List” instead of “Vector”.




                                                                    .      .   .   .   .   .

Java Technicalities                                                                        34/58
Library and Programming   Container and HashTable




  Example: java.util.List<E>

For Example: Count words of a file (1–2)

public int fileWordCount(String filename){
    try{
        List<String> fileList = readFile(filename);
        int totalWords =0;
        for(int i=0;i<fileList.size();i++){
         totalWords += fileList.get(i).split(" ").length;
        }
        return totalWords;
    }
    catch(Exception e){
        System.out.println(e);
    }
    return -1;
}
                                                               .      .   .   .   .   .

Java Technicalities                                                                   35/58
Library and Programming   Container and HashTable




  Example: java.util.List<E> (2–2)

For Example: Count words of a file

public ArrayList<String> readFile(String filename) throws IOException{
    try{
         ArrayList<String> u = new ArrayList<String>();
      BufferedReader in = new BufferedReader(new FileReader(filename));
         String readLine = null;
         while((readLine = in.readLine())!=null){
             u.add(readLine);
         }
         in.close();
         if(u.isEmpty()) return null;
         else return u;
    }
    catch(FileNotFoundException e){
         System.out.println(e);
    }
    return null;
}

                                                               .      .   .   .   .   .

Java Technicalities                                                                   36/58
Library and Programming   Container and HashTable




  HashTable — java.util.HashMap<K, V>
        HashMap can support the same functionality as HashTable.
        Please use java.util.HashMap<K, V> instead of
        java.util.HashTable<K, V>
        K is key, V is Value
        If you want use some class as a key, please check the class override
        “Object.hashCode()” and “Object.equals()”.




                                                                 .      .   .   .   .   .

Java Technicalities                                                                     37/58
Library and Programming   Container and HashTable




  Example: HashMap

For Example: HashMap list all entries

HashMap<String, Integer> nameAge =
     new HashMap<String, Integer>();
nameAge.put("John", 15); nameAge.put("Mary", 17);

Set<Map.Entry<String, Integer>> set = nameAge.entrySet();
Iterator<Map.Entry<String, Integer>> iter = set.iterator();
while(iter.hasNext()){
    Map.Entry<String, Integer> e = iter.next();
    System.out.println(e.getKey() + " " + e.getValue());
}

                                                               .      .   .   .   .   .

Java Technicalities                                                                   38/58
Library and Programming   Java I/O




  Java I/O
          What is a “Stream”?
          In Unix/Unix-like, everything is a file.
          Java I/O Library is a pure OO paradigm example, and C++ is too.
          You can get an overview by java.io.* hierarchy tree.7 It will helps
          you to understand how to write I/O codes.




     7
         http://java.sun.com/j2se/1.4.2/docs/api/java/io/package-tree.html
                                                            .    .     .     .   .   .

Java Technicalities                                                                  39/58
Library and Programming   Java I/O




  Java I/O: Two Methods
Java has “InputStream/ OutputStream”, “Reader/ Writer”
          InputStream/ OutputStream read 1 byte at a time.
          Reader/ Writer read a char at a time.8
          Reader/ Writer default encoding is UTF8.
          Recall: Java’s String type default encoding is UTF8.
          Which can be used depends on your source.




     8
         a char can be 1 byte, 2 bytes, ...                        .   .   .   .   .   .

Java Technicalities                                                                    40/58
Library and Programming   Java I/O




  Java I/O: InputStream/ OutputStream
        InputStream/ OutputStream
                 ByteArrayInputStream/ ByteArrayOutputStream
                 — for String.getBytes(); (1 byte string)
                 FileInputStream/ FileOutputStream
                 — for files
                 Socket.getInputStream()/ Sokcet.getOutputStream()
                 — for Socket
                 Process.getInputStream()/ Process.getOutputStream()
                 — for Process Control

You can use the above to adapt to the following
        BufferedInputStream/ BufferedOutputStream
        — Support readLine()
        DataInputStream/ DataOutputStream
        — Support readInt() ...                                  .   .   .   .   .   .

Java Technicalities                                                                  41/58
Library and Programming   Java I/O




  Java I/O: Reader/Writer
        Reader/ Writer
                 StringReader/ StringWriter — for a String.
                 FileReader/ FileWriter — for a file.
                 CharArrayReader/ CharArrayWriter – for memory

You can use the above to adapt to the following
        BufferedReader/ BufferedWriter — Support readLine()
        Scanner/ not support




                                                                 .   .   .   .   .   .

Java Technicalities                                                                  42/58
Library and Programming   Java I/O




  Java I/O: Others
The Bridge between InputStream/ OutputStream and Reader/ Writer
    InputStreamReader/ OutputStreamWriter
        — Stream translate to Reader/Writer

For Example: Socket

BufferedReader br = new BufferedReader(
      new InputStreamReader(Socket.getInputStream()));



The following is not maintained.
    RandomAccessFile
    ObjectInputStream/ ObjectOutputStream
    Java.nio (New I/O)                                       .   .   .   .   .   .

Java Technicalities                                                              43/58
Library and Programming   Java I/O




  Example: evaluate the sum

For Example: evaluate the sum

public int evaluateSumByScanner(String s){
    StringReader sr = new StringReader(s);
    Scanner scanner = new Scanner(sr);

         int sum = 0;
         while(scanner.hasNext()){
             sum += scanner.nextInt();
         }
         sr.close();
         return sum;
}
                                                           .   .   .   .   .   .

Java Technicalities                                                            44/58
Library and Programming   Java I/O




  Socket Programming
          Socket Programming is the same as writing to files because we
          consider socket as a file stream.
          use “Buffered I/O” (ex: class java.io.BufferedWriter, class
          java.io.BufferedReader)
          We have to be care about the message’s format.(fixed format or XML
          formt)
          Please don’t use “n” as a message’s end!
          Please remember “Base64” format when you send binary messages.9
          Reference: yen3’s blog –            File I/O               (1)               ,
          (2) Binary File, (3) XML



     9
         http://en.wikipedia.org/wiki/Base64                     .     .   .   .   .       .

Java Technicalities                                                                        45/58
Library and Programming   Java I/O




  Socket Programming
        Client – java.net.Socket
        Server – java.net.ServerSocket
        Usually, We use Socket Programming together with Multi-threading
        Programming in Server.
        Don’t forget “ThreadPool”(java.util.concurrent.Executors)




                                                            .   .   .   .   .   .

Java Technicalities                                                             46/58
Library and Programming   JDBC — Java Database Connectivity




  JDBC — Java Database Connectivity
        an API for the Java programming language that defines how a client
        may access a database.
        It provides methods for querying and updating data in a database.
        JDBC is oriented towards relational databases.
        Reference: Wiki: Java Database Connectivity
        Reference: caterpillar: Java                                       (JDBC)
        How To use?




                                                                .      .      .       .   .   .

Java Technicalities                                                                           47/58
Library and Programming   JDBC — Java Database Connectivity




  JDBC Example: MySQL
        Please install MySQL. XD
        Please download MySQL Connector/J 5.1, the offical JDBC driver,
        you will get a “jar” file.




        In Eclipse, press “Add External JARs...”, choose the file you
        downloaded.
        Have fun!




                                                                .      .      .       .   .   .

Java Technicalities                                                                           48/58
Library and Programming   JDBC — Java Database Connectivity




  JDBC Example: Java and MySQL

For Example: List a table

public void testMySQL(){
    String driver = "com.mysql.jdbc.Driver";
    String serverName = "localhost";
    String databaseName = "information_schema";
    String tableName = "TABLES";
    String user = "yourname";
    String password = "yourpassword";
    String url = "jdbc:mysql://"+ serverName +"/" + databaseName;




                                                              .      .      .       .   .   .

Java Technicalities                                                                         49/58
Library and Programming   JDBC — Java Database Connectivity




  JDBC Example: Java and MySQL

For Example: List a table

       try {
           Class.forName(driver);
        Connection conn = (Connection) DriverManager.getConnection(url, user, password);
           Statement stmt = (Statement) conn.createStatement();
           ResultSet result = stmt.executeQuery("SELECT * FROM" + " " + tableName);
           while (result.next()) {
                int numColumns = result.getMetaData().getColumnCount();
                for (int i = 1; i <= numColumns; i++) {
                    System.out.println("COLUMN " + i + " = "
                    + result.getObject(i));
                }
           }
           conn.close();
        }
        catch(ClassNotFoundException e) {
             System.out.println("Can not find JDBC driver");
        }
        catch (SQLException e) {
             e.printStackTrace();
        }
}
                                                                 .      .      .       .   .   .

Java Technicalities                                                                            50/58
Conclusion   Conclusion




  Conclusion
        We go through Java from different parts, especially from C/C++.
        We go through some Java Library ... There are a lot of examples.
        Please review it. XD
        Java is a noun-kingdom XDXD. (What do you think about when
        seeing “ArrayIndexOutOfBoundsException” first time?)
        Please love “Eclipse IDE” when developing Java programs. XD
        Let’s expect the interesting issue next week . XD




                                                          .   .   .   .   .   .

Java Technicalities                                                           51/58
Conclusion   Conclusion




              Do you have any problem ?
            I am glad you have listened the slides from start to now. XD




                                                            .   .   .   .   .   .

Java Technicalities                                                             52/58
Conclusion   Reference




  Reference — Website
        Java SE Documentation –
        http://java.sun.com/javase/downloads/index.jsp
        Eclipse.org – http://www.eclipse.org
                           – http://caterpillar.onlyfun.net/Gossip/

        C++ Boost Library – http://www.boost.org
        SGI STL – http://www.sgi.com/tech/stl/
        TIOBE Software: Tiobe Index –
        http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html




                                                         .   .   .   .   .   .

Java Technicalities                                                          53/58
Conclusion   Reference




  Reference — Java
        Thinking in Java 4/e, Bruce Eckel, ISBN: 0131872486
        The Java Programming Language 4/e, Ken Arnold, James Gosling,
        David Holmes , ISBN: 0321349806
        Effective Java 2/e, Joshua Bloch, ISBN: 0321356683
        Practical Java(TM) Programming Language Guide, Peter Haggar,
        ISBN: 0201616467
        The Art of Java, Herbert Schildt, James Holmes, ISBN: 0072229713
        Java Network Programming 3/e, Elliotte Rusty Harold, ISBN:
        0596007213
        Java Swing 2/e, James Elliott, Robert Eckstein, Marc Loy, David
        Wood, Brian Cole, ISBN: 0596004087

                                                         .   .   .   .   .   .

Java Technicalities                                                          54/58
Conclusion   Reference




  Reference — Object Oriented Analysis/ Design/ Programming
        Object-Oriented Analysis and Design with Applications 3/e, Grady
        Booch, Robert A. Maksimchuk, Michael W. Engel, Bobbi J. Young,
        ISBN: 020189551
        Design Patterns: Elements of Reusable Object-Oriented Software,
        Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, ISBN:
        0201663612
        Refactoring: Improving the Design of Existing Code, Martin Fowler,
        Kent Beck, John Brant, William Opdyke, don Roberts, ISBN:
        0201485672
        Refactroing to Pattens, Joshua Kerievsky, ISBN: 0321213351
        Agile Software Development, Principles, Patterns, and Practices,
        Robert C. Martin
                                                         .   .   .   .   .   .

Java Technicalities                                                          55/58
Conclusion   Reference




  Reference — C/C++ and Other
        Real World Haskell, Bryan O’Sullivan, John Goerzen, Don Stewart,
        ISBN: 0596514980
        The C++ Programming Language 3/e, Bjarne Stroustrup, ISBN:
        0201700735
        The C Programming Language 2/e, Brian W. Kernighan, Dennis M.
        Ritchie, ISBN: 0131193716
        C++ Primer 4/e, Stanley B. Lippman, Josée Lajoie, and Barbara E.
        Moo, ISBN: 0201721481
        Effective C++ 3/e: 55 Specific Ways to Improve Your Programs and
        Designs, Scott Meyers, ISBN: 0321334876
        Generic Programming and the STL: Using and Extending the C++
        Standard Template Library, Matthew H. Austern, ISBN: 0201309564
                                                        .   .   .   .   .   .

Java Technicalities                                                         56/58
Conclusion   Reference




  Appendix A: How to get a html String

For Example: How to get a html String

public String getHtmlString(String inputUrl){
    try{
         URLConnection url = (new URL(inputUrl)).openConnection();
         BufferedReader br = new BufferedReader(
                    new InputStreamReader(url.getInputStream()));
         int length=-1;
         StringBuffer sb = new StringBuffer();
         char[] temp = new char[1024];
         while((length=br.read(temp, 0, 1024))!= -1){
             sb.append(temp, 0, length);
     }
    br.close();
    return sb.toString();
    }catch (MalformedURLException ex) {
         System.err.println(inputUrl + "is not parseable URL");
    }catch (IOException ex) {
         System.err.println(ex);
}
    return null;
}                                                .   .   .    .    .   .

Java Technicalities                                                    57/58
Conclusion   Reference




  Appendix B: How to write Java Program
        Please install “Java Developer Kit(JDK)” and “Java Runtime
        Environment”
        Please set “PATH” and “CLASSPATH” in Windows.
        You can download “Eclipse” as your default Java Develop IDE.
        Have fun!




                                                        .   .   .   .   .   .

Java Technicalities                                                         58/58

Más contenido relacionado

La actualidad más candente

Java Concurrency Starter Kit
Java Concurrency Starter KitJava Concurrency Starter Kit
Java Concurrency Starter KitMark Papis
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIwhite paper
 
8 most expected java interview questions
8 most expected java interview questions8 most expected java interview questions
8 most expected java interview questionsPoonam Kherde
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)SURBHI SAROHA
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpointravi tyagi
 
Class notes(week 9) on multithreading
Class notes(week 9) on multithreadingClass notes(week 9) on multithreading
Class notes(week 9) on multithreadingKuntal Bhowmick
 
10 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_1410 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_14Niit Care
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05Niit Care
 
Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocationRiccardo Cardin
 
Java Reflection Explained Simply
Java Reflection Explained SimplyJava Reflection Explained Simply
Java Reflection Explained SimplyCiaran McHale
 
13 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_1913 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_19Niit Care
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questionsGradeup
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08Niit Care
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design PatternsAnton Keks
 
Applying Anti-Reversing Techniques to Java Bytecode
Applying Anti-Reversing Techniques to Java BytecodeApplying Anti-Reversing Techniques to Java Bytecode
Applying Anti-Reversing Techniques to Java BytecodeTeodoro Cipresso
 
Top 10 Interview Questions For Java
Top 10 Interview Questions For JavaTop 10 Interview Questions For Java
Top 10 Interview Questions For JavaEME Technologies
 

La actualidad más candente (19)

Java Concurrency Starter Kit
Java Concurrency Starter KitJava Concurrency Starter Kit
Java Concurrency Starter Kit
 
Java interview question
Java interview questionJava interview question
Java interview question
 
Pocket java
Pocket javaPocket java
Pocket java
 
Introduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging APIIntroduction to the Java(TM) Advanced Imaging API
Introduction to the Java(TM) Advanced Imaging API
 
8 most expected java interview questions
8 most expected java interview questions8 most expected java interview questions
8 most expected java interview questions
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
 
201 core java interview questions oo ps interview questions - javatpoint
201 core java interview questions   oo ps interview questions - javatpoint201 core java interview questions   oo ps interview questions - javatpoint
201 core java interview questions oo ps interview questions - javatpoint
 
Reflection in Java
Reflection in JavaReflection in Java
Reflection in Java
 
Class notes(week 9) on multithreading
Class notes(week 9) on multithreadingClass notes(week 9) on multithreading
Class notes(week 9) on multithreading
 
10 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_1410 iec t1_s1_oo_ps_session_14
10 iec t1_s1_oo_ps_session_14
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05
 
Java - Remote method invocation
Java - Remote method invocationJava - Remote method invocation
Java - Remote method invocation
 
Java Reflection Explained Simply
Java Reflection Explained SimplyJava Reflection Explained Simply
Java Reflection Explained Simply
 
13 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_1913 iec t1_s1_oo_ps_session_19
13 iec t1_s1_oo_ps_session_19
 
20 most important java programming interview questions
20 most important java programming interview questions20 most important java programming interview questions
20 most important java programming interview questions
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
 
Applying Anti-Reversing Techniques to Java Bytecode
Applying Anti-Reversing Techniques to Java BytecodeApplying Anti-Reversing Techniques to Java Bytecode
Applying Anti-Reversing Techniques to Java Bytecode
 
Top 10 Interview Questions For Java
Top 10 Interview Questions For JavaTop 10 Interview Questions For Java
Top 10 Interview Questions For Java
 

Destacado

Can you learn to love? The science and experience of human attachment
Can you learn to love? The science and experience of human attachmentCan you learn to love? The science and experience of human attachment
Can you learn to love? The science and experience of human attachmentDr. Jonathan Mall
 
Girls vs boys
Girls vs boysGirls vs boys
Girls vs boyscarlyrelf
 
2017 Avvo Modern Love and Relationship Study
2017 Avvo Modern Love and Relationship Study2017 Avvo Modern Love and Relationship Study
2017 Avvo Modern Love and Relationship StudyAvvo
 
Kinds Of Love Relationships
Kinds Of Love RelationshipsKinds Of Love Relationships
Kinds Of Love Relationshipsvik coolboy
 
Stages in Love Relationship
Stages in Love RelationshipStages in Love Relationship
Stages in Love RelationshipEdz Gapuz
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic Manzoor ALam
 
Stages of love/Neurochemistry of Love
Stages of love/Neurochemistry of LoveStages of love/Neurochemistry of Love
Stages of love/Neurochemistry of LoveEssence
 
Programming Terminology
Programming TerminologyProgramming Terminology
Programming TerminologyMichael Henson
 
Wearable Tech - Trends for 2016
Wearable Tech - Trends for 2016Wearable Tech - Trends for 2016
Wearable Tech - Trends for 2016Scott Eggertsen
 
11 Signs Of A Sneaky Sociopath
11 Signs Of A Sneaky Sociopath11 Signs Of A Sneaky Sociopath
11 Signs Of A Sneaky SociopathInstant Checkmate
 
25 Cars Worth Waiting For 2016–2019
25 Cars Worth Waiting For 2016–201925 Cars Worth Waiting For 2016–2019
25 Cars Worth Waiting For 2016–2019Eason Chan
 
The Future of Wearables... EXPLAINED!
The Future of Wearables... EXPLAINED!The Future of Wearables... EXPLAINED!
The Future of Wearables... EXPLAINED!Paul Brown
 
Buying Your First Car
Buying Your First CarBuying Your First Car
Buying Your First CarEason Chan
 
Teaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakTeaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakShelly Sanchez Terrell
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerLuminary Labs
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with DataSeth Familian
 

Destacado (18)

Can you learn to love? The science and experience of human attachment
Can you learn to love? The science and experience of human attachmentCan you learn to love? The science and experience of human attachment
Can you learn to love? The science and experience of human attachment
 
Girls vs boys
Girls vs boysGirls vs boys
Girls vs boys
 
2017 Avvo Modern Love and Relationship Study
2017 Avvo Modern Love and Relationship Study2017 Avvo Modern Love and Relationship Study
2017 Avvo Modern Love and Relationship Study
 
Kinds Of Love Relationships
Kinds Of Love RelationshipsKinds Of Love Relationships
Kinds Of Love Relationships
 
Stages in Love Relationship
Stages in Love RelationshipStages in Love Relationship
Stages in Love Relationship
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic
 
Stages of love/Neurochemistry of Love
Stages of love/Neurochemistry of LoveStages of love/Neurochemistry of Love
Stages of love/Neurochemistry of Love
 
Programming Terminology
Programming TerminologyProgramming Terminology
Programming Terminology
 
Wearable Tech - Trends for 2016
Wearable Tech - Trends for 2016Wearable Tech - Trends for 2016
Wearable Tech - Trends for 2016
 
11 Signs Of A Sneaky Sociopath
11 Signs Of A Sneaky Sociopath11 Signs Of A Sneaky Sociopath
11 Signs Of A Sneaky Sociopath
 
25 Cars Worth Waiting For 2016–2019
25 Cars Worth Waiting For 2016–201925 Cars Worth Waiting For 2016–2019
25 Cars Worth Waiting For 2016–2019
 
Can Your Genes Make You Happier?
Can Your Genes Make You Happier?Can Your Genes Make You Happier?
Can Your Genes Make You Happier?
 
The Future of Wearables... EXPLAINED!
The Future of Wearables... EXPLAINED!The Future of Wearables... EXPLAINED!
The Future of Wearables... EXPLAINED!
 
Buying Your First Car
Buying Your First CarBuying Your First Car
Buying Your First Car
 
Teaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakTeaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & Textspeak
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
 

Similar a Java Technicalities (20)

Java Starting
Java StartingJava Starting
Java Starting
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Java Lecture 1
Java Lecture 1Java Lecture 1
Java Lecture 1
 
Java1
Java1Java1
Java1
 
Java
Java Java
Java
 
Basics java programing
Basics java programingBasics java programing
Basics java programing
 
Features of Java.pptx
Features of Java.pptxFeatures of Java.pptx
Features of Java.pptx
 
00 intro to java
00 intro to java00 intro to java
00 intro to java
 
Javanotes ww8
Javanotes ww8Javanotes ww8
Javanotes ww8
 
Java notes
Java notesJava notes
Java notes
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
01slide
01slide01slide
01slide
 
JNA - Let's C what it's worth
JNA - Let's C what it's worthJNA - Let's C what it's worth
JNA - Let's C what it's worth
 
Unit1 introduction to Java
Unit1 introduction to JavaUnit1 introduction to Java
Unit1 introduction to Java
 
Core java
Core javaCore java
Core java
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbai
 
Notes of java first unit
Notes of java first unitNotes of java first unit
Notes of java first unit
 

Más de Wen-Shih Chao

Write unit test from scratch
Write unit test from scratchWrite unit test from scratch
Write unit test from scratchWen-Shih Chao
 
Programming with effects - Graham Hutton
Programming with effects - Graham HuttonProgramming with effects - Graham Hutton
Programming with effects - Graham HuttonWen-Shih Chao
 
近未來三人女子電音偶像團體 Perfume
近未來三人女子電音偶像團體 Perfume近未來三人女子電音偶像團體 Perfume
近未來三人女子電音偶像團體 PerfumeWen-Shih Chao
 
Matrix Chain Scheduling Algorithm
Matrix Chain Scheduling AlgorithmMatrix Chain Scheduling Algorithm
Matrix Chain Scheduling AlgorithmWen-Shih Chao
 
漫談 Source Control Management
漫談 Source Control Management漫談 Source Control Management
漫談 Source Control ManagementWen-Shih Chao
 
淺談排版系統 Typesetting System
淺談排版系統 Typesetting System淺談排版系統 Typesetting System
淺談排版系統 Typesetting SystemWen-Shih Chao
 

Más de Wen-Shih Chao (6)

Write unit test from scratch
Write unit test from scratchWrite unit test from scratch
Write unit test from scratch
 
Programming with effects - Graham Hutton
Programming with effects - Graham HuttonProgramming with effects - Graham Hutton
Programming with effects - Graham Hutton
 
近未來三人女子電音偶像團體 Perfume
近未來三人女子電音偶像團體 Perfume近未來三人女子電音偶像團體 Perfume
近未來三人女子電音偶像團體 Perfume
 
Matrix Chain Scheduling Algorithm
Matrix Chain Scheduling AlgorithmMatrix Chain Scheduling Algorithm
Matrix Chain Scheduling Algorithm
 
漫談 Source Control Management
漫談 Source Control Management漫談 Source Control Management
漫談 Source Control Management
 
淺談排版系統 Typesetting System
淺談排版系統 Typesetting System淺談排版系統 Typesetting System
淺談排版系統 Typesetting System
 

Último

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Último (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

Java Technicalities

  • 1. Java Technicalities From a C/C++ Programmer’s View yen3 Dept. of Computer Science and Information Engineering, Chang Gung University April 15, 2009 . . . . . . Java Technicalities 1/58
  • 2. Introduction About About Author Computer Science Student Blog: No title, no thinking, no meaning E-mail: yen3rc gmail C, C++, Java, Haskell, LTEX A . . . . . . Java Technicalities 2/58
  • 3. Introduction Outline Introduction About Introduction Technicalities Type Class and Object Generic in Java (igonred) Exception Library and Programming String Container and HashTable Java I/O JDBC — Java Database Connectivity Conclusion Conclusion Reference . . . . . . Java Technicalities 3/58
  • 4. Introduction Outline About Slide Josh Ko (Joshsoft) XD The slide is made by XELTEX and Beamer. XD A The Color Theme designed by Josh Ko uses Oxford brand colors1 . 1 http://www.ox.ac.uk/staff/branding toolkit/the brand colours/index.html . . . . . . Java Technicalities 4/58
  • 5. Introduction Outline Something About Guang-Wu Chen’s Requirement He hopes you understand the following topics. String (all kinds of string/character processing stuff) StringTokenizer Hashtable (or other containers such as Vector, etc.) JDBC related ones, including Connector, Statement, ResultSet. I/O classes, of course. . . . . . . Java Technicalities 5/58
  • 6. Introduction Introduction But ... XD XD . . . . . . Java Technicalities 6/58
  • 7. Introduction Introduction But ... XD XD Josh Ko and yen3’s Talking yen3: Java ...Orz Josh Ko: XD yen3: Java Functional Programming XD Josh Ko: , Java OO XD . . . . . . Java Technicalities 6/58
  • 8. Introduction Introduction Everything is an Object. Thinking in Java 4/e . . . . . . Java Technicalities 7/58
  • 9. Introduction Introduction Programming By Compiler Compiled Programming language Interpreted Programming language (Script Programming Language) By Machine Imperative Programming (Turing Machine) Functional Programming (λ-calculus) By Model Procedural Programming Object-Based Programming (Abstract Data Type) Object-Oriented Programming Generic Programming . . . . . . Java Technicalities 8/58
  • 10. Introduction Introduction TIOBE Programming Community Index for March 2009 . . . . . . Java Technicalities 9/58
  • 11. Introduction Introduction About Java James Gosling, 1995, Sun Microsystems a pure Object-Oriented Programming Language Everything is an object. Java Virtual Machine and Just-In-Time Compiler XD Java SE, Java EE, Java ME The language has already been developed for over 10 years and become a complete programming language. So, What do we know from Java ? . . . . . . Java Technicalities 10/58
  • 12. Technicalities Type Type Java has two different types. primitive type: int, char, double, balabala pointer type: class type(user-defined type) We know that Java doesn’t have “pointers” Java has “new”, but no “delete” keyword. What is Garbage Collection? What is Java’s memory management mechanism? (It’s an important factor about Java’s program efficiency.) . . . . . . Java Technicalities 11/58
  • 13. Technicalities Type String Type String has build-in type’s interface with pointer type’s implementation. String vs. StringBuffer2 What does the language do in background? Let’s talk about an example. 2 In Java, StringBuilder provides an API compatible with StringBuffer, but with no guarantee of synchronization. . . . . . . Java Technicalities 12/58
  • 14. Technicalities Type Type-Casting Java is strongly-typed programming language. void* vs. java.lang.Object In Java, every class inherits from java.lang.Object. It means we can cast an object to java.lang.Object type and cast again to other arbitrary class type . Compiler doesn’t check the situation because it seems legal from the syntactical perspective. You have to check the situation by yourself. . . . . . . Java Technicalities 13/58
  • 15. Technicalities Class and Object Thinking about The Problems What is a “type”? A Type just like requirement.3 (in Functional Programming) What is a “object”? OO is claimed to be closer to human thoughts. However, is it true ? Object vs java.lang.Object Why doesn’t Java support “Operator Overloading”? “Operator Overloading is syntax sugar. You don’t know how efficient you cost in using.” 3 Think about “Rules” . . . . . . Java Technicalities 14/58
  • 16. Technicalities Class and Object Class and Object A Class has ... data member (Data) – Record States member function(Method) A Class has three modes public – interface private – implements protected – for some reasons XD We have to pay attention to two keywords, but the slide doesn’t mention. static final . . . . . . Java Technicalities 15/58
  • 17. Technicalities Class and Object Class There are several kinds of classes. Normal Class – There’s nothing to say. XD Interface – Think about multiple-inheritance. anonymous Class – Think about the relationship about function pointer and call-back function. . . . . . . Java Technicalities 16/58
  • 18. Technicalities Class and Object Back to C — Function Pointer Von Neumann’s Model says program can be saved in memory. If we ruled the function’s interface, we can show difference functionality by replacing functions rely on function pointer. For Example: C’ stdlib.h — qsort() protype void qsort(void* base, size_t n, size_t size, int (*cmp)(const void*, const void*)); /* function pointer */ . . . . . . Java Technicalities 17/58
  • 19. Technicalities Class and Object Back to C++ — Function Object The most difference between Function Object and Function Pointer is Function Object has own states(variable). Implementation: Class with Operator Overloading “()” If we implemented function object with template. It stars the Generic Programming’s first step. For Example: C++ — Function Object template<typename T> class Less{ public: bool operator()(const T& x, const T& y){ return x < y;} } . . . . . . Java Technicalities 18/58
  • 20. Technicalities Class and Object λ Function (Lambda Function) base on lambda-expressions from Functional Programming,. no side-effect function. an unnamed function for temporary uses Haskell n´ive support a C++’s support: Boost::lambda For Example: C++ — Boost::lambda std::sort(v.begin(), v.end(), std::greater<iterator_traits(v.begin())::value_type>()); std::sort(v.begin(), v.end(), *_1 > *_2); . . . . . . Java Technicalities 19/58
  • 21. Technicalities Class and Object Call-Back Function — Anonymous Class with Interface What is “Call-Back Function”? How does JavaScript support the Call-Back Function? Class-Based vs Prototype-Based Java uses anonymous class and interface(Runnable) to support call-back property. For Example: Java — anonymous class with interface Thread newTask = new Thread(new Runnable(){ public void run(){ System.out.println("Hello World!"); }}); . . . . . . Java Technicalities 20/58
  • 22. Technicalities Class and Object Interface and Abstract Class interface and abstract are keywords. Interface and abstract classes provide a more structured way to separate interface from implementation. In begin, we always have no idea to use them. It’s show time to use “Refactoring”. We can extract to super class, abstract class, or interface from the same functionality classes. Button-Up Design vs Top-Down Design . . . . . . Java Technicalities 21/58
  • 23. Technicalities Class and Object Object-Oriented Class For efficient reason, C++ default member function mode is non-virtual, but Java is not. Please read the relational books to get more details about Java’s Class. The feature is implemented by function pointer table. Think about the relation of RTTI and function pointer table. How to Design Class? Traditional OO Design vs eXtreme Programming4 4 We will discuss the issue next week. . . . . . . Java Technicalities 22/58
  • 24. Technicalities Generic in Java (igonred) Generic in Java Let’s ignore the topic. We can discuss the topic if we have a basic knowledge for C++ Generic Programming. C++’s STL is made from some Functional Programming concepts. Java’s Generic is made by Java OO method. In fact, Java’s Generic is still a OO paradigm. You can play the paradigm using Haskell. It’s more interesting than C++ and Java. XD . . . . . . Java Technicalities 23/58
  • 25. Technicalities Exception Exception What is a “Exception”? “GOTO Considered Harmful.”5 Think about the relation between “goto” and “exceptions”. We have to know program execute the exception block means low efficiency. But we couldn’t ignore writing exception when using some library(ex: I/O, Socket, Thread) 5 Edsger W. Dijkstra, Turing Award 1972 . . . . . . Java Technicalities 24/58
  • 26. Library and Programming Library Muti-Threading Programming – java.util.concurrent.* GUI Programming – javax.swing.* Socket Programming – java.net.* Generic Container – java.util.* (just for some classes) 6 I/O – java.io.* (It is a good OO design example. balabala Don’t forget gwchen’s requirements. XD 6 In C++, Generic Container is more interesting than Java. . . . . . . Java Technicalities 25/58
  • 27. Library and Programming How to find Java Document ? Please have a book named “Thinking in Java 4/e”. XD Google Keyword – “your keywords site:http://java.sun.com/javase/6/docs/” Eclipse code completes Google XD . . . . . . Java Technicalities 26/58
  • 28. Library and Programming String What is a String? What is a “char”? What is a “string” ? What’s difference between “char array” and “string” ? char’s size is 1 byte. string’s element is not always using 1 byte for saving information. Maybe using 2 bytes, or ... Java’s String uses UTF-8 as default encoding. . . . . . . Java Technicalities 27/58
  • 29. Library and Programming String String method charAt & indexOf isEmpty startsWith & endsWith getBytes & getChars subString toCharArray contains toLowerCase & toUpperCase replace & replaceAll & format replaceFirst trim matchs . . . . . . Java Technicalities 28/58
  • 30. Library and Programming String java.util.StringTokenizer http://java.sun.com/javase/6/docs/api/java/util/StringTokenizer.html It can break a string into tokens. If you want to complexing method for separating string, you can using “Regular Expression” and java.lang.String.split(). . . . . . . Java Technicalities 29/58
  • 31. Library and Programming String Example: java.util.StringTokenizer For Example: evaluate the sum of numbers String s="123 456 789"; StringTokenizer token = new StringTokenizer(s, " "); int sum=0; while(token.hasMoreTokens()){ sum += Integer.parseInt(token.nextToken()); } System.out.println("The sum is: " + sum + "n"); . . . . . . Java Technicalities 30/58
  • 32. Library and Programming String Example: java.lang.String.split() Attention: the argument using “Regular Expression”. For Example: evaluate the sum of numbers String s = "123 456 789"; String[] split = s.split(" "); int sum=0; for(int i=0;i<split.length;i++){ sum += Integer.parseInt(split[i]); } System.out.println("The sum is: " + sum + "n"); . . . . . . Java Technicalities 31/58
  • 33. Library and Programming Container and HashTable Java Container In Java 1.0/1.1, Java uses “Object Container”, but not suggests using for now. Java uses “Generic Container” instead of “Object Container” in Java 1.4 and after. Why does Java do? Please first consider “Array” unless you have enough reasons to use Java Container. And you can’t use primitive type in Generic Container, please use “type wrapper class” instead of “primitive type”. For example: type wrapper class List<int> u = new ArrayList<int>; // wrong List<Integer> u = new ArrayList<Integer>; // right . . . . . . Java Technicalities 32/58
  • 34. Library and Programming Container and HashTable Class Hierarchy Tree java.util.Arrays java.util.Collection<E> java.util.List<E> java.util.Queue<E> java.util.Deque<E> java.util.Set<E> java.util.SortedSet<E> java.util.Map<K, V> java.util.SortedMap<K, V> java.util.Dictionary<K, V> java.util.Hashtable<K, V> java.util.AbstractMap<K, V> java.util.HashMap<K, V> java.util.LinkedHashMap<K, V> java.util.TreeMap<K, V> . . . . . . Java Technicalities 33/58
  • 35. Library and Programming Container and HashTable Vector — java.util.List<E> java.util.List<E> is an interface class. The Most frequently using List is java.util.List.ArrayList In interface, like C++’s std::vector<typename T> add() vs. push back() get() vs. operator[] size() vs. size() Although “Vector<E>” can be used, but Java’s doc suggests using “List” instead of “Vector”. . . . . . . Java Technicalities 34/58
  • 36. Library and Programming Container and HashTable Example: java.util.List<E> For Example: Count words of a file (1–2) public int fileWordCount(String filename){ try{ List<String> fileList = readFile(filename); int totalWords =0; for(int i=0;i<fileList.size();i++){ totalWords += fileList.get(i).split(" ").length; } return totalWords; } catch(Exception e){ System.out.println(e); } return -1; } . . . . . . Java Technicalities 35/58
  • 37. Library and Programming Container and HashTable Example: java.util.List<E> (2–2) For Example: Count words of a file public ArrayList<String> readFile(String filename) throws IOException{ try{ ArrayList<String> u = new ArrayList<String>(); BufferedReader in = new BufferedReader(new FileReader(filename)); String readLine = null; while((readLine = in.readLine())!=null){ u.add(readLine); } in.close(); if(u.isEmpty()) return null; else return u; } catch(FileNotFoundException e){ System.out.println(e); } return null; } . . . . . . Java Technicalities 36/58
  • 38. Library and Programming Container and HashTable HashTable — java.util.HashMap<K, V> HashMap can support the same functionality as HashTable. Please use java.util.HashMap<K, V> instead of java.util.HashTable<K, V> K is key, V is Value If you want use some class as a key, please check the class override “Object.hashCode()” and “Object.equals()”. . . . . . . Java Technicalities 37/58
  • 39. Library and Programming Container and HashTable Example: HashMap For Example: HashMap list all entries HashMap<String, Integer> nameAge = new HashMap<String, Integer>(); nameAge.put("John", 15); nameAge.put("Mary", 17); Set<Map.Entry<String, Integer>> set = nameAge.entrySet(); Iterator<Map.Entry<String, Integer>> iter = set.iterator(); while(iter.hasNext()){ Map.Entry<String, Integer> e = iter.next(); System.out.println(e.getKey() + " " + e.getValue()); } . . . . . . Java Technicalities 38/58
  • 40. Library and Programming Java I/O Java I/O What is a “Stream”? In Unix/Unix-like, everything is a file. Java I/O Library is a pure OO paradigm example, and C++ is too. You can get an overview by java.io.* hierarchy tree.7 It will helps you to understand how to write I/O codes. 7 http://java.sun.com/j2se/1.4.2/docs/api/java/io/package-tree.html . . . . . . Java Technicalities 39/58
  • 41. Library and Programming Java I/O Java I/O: Two Methods Java has “InputStream/ OutputStream”, “Reader/ Writer” InputStream/ OutputStream read 1 byte at a time. Reader/ Writer read a char at a time.8 Reader/ Writer default encoding is UTF8. Recall: Java’s String type default encoding is UTF8. Which can be used depends on your source. 8 a char can be 1 byte, 2 bytes, ... . . . . . . Java Technicalities 40/58
  • 42. Library and Programming Java I/O Java I/O: InputStream/ OutputStream InputStream/ OutputStream ByteArrayInputStream/ ByteArrayOutputStream — for String.getBytes(); (1 byte string) FileInputStream/ FileOutputStream — for files Socket.getInputStream()/ Sokcet.getOutputStream() — for Socket Process.getInputStream()/ Process.getOutputStream() — for Process Control You can use the above to adapt to the following BufferedInputStream/ BufferedOutputStream — Support readLine() DataInputStream/ DataOutputStream — Support readInt() ... . . . . . . Java Technicalities 41/58
  • 43. Library and Programming Java I/O Java I/O: Reader/Writer Reader/ Writer StringReader/ StringWriter — for a String. FileReader/ FileWriter — for a file. CharArrayReader/ CharArrayWriter – for memory You can use the above to adapt to the following BufferedReader/ BufferedWriter — Support readLine() Scanner/ not support . . . . . . Java Technicalities 42/58
  • 44. Library and Programming Java I/O Java I/O: Others The Bridge between InputStream/ OutputStream and Reader/ Writer InputStreamReader/ OutputStreamWriter — Stream translate to Reader/Writer For Example: Socket BufferedReader br = new BufferedReader( new InputStreamReader(Socket.getInputStream())); The following is not maintained. RandomAccessFile ObjectInputStream/ ObjectOutputStream Java.nio (New I/O) . . . . . . Java Technicalities 43/58
  • 45. Library and Programming Java I/O Example: evaluate the sum For Example: evaluate the sum public int evaluateSumByScanner(String s){ StringReader sr = new StringReader(s); Scanner scanner = new Scanner(sr); int sum = 0; while(scanner.hasNext()){ sum += scanner.nextInt(); } sr.close(); return sum; } . . . . . . Java Technicalities 44/58
  • 46. Library and Programming Java I/O Socket Programming Socket Programming is the same as writing to files because we consider socket as a file stream. use “Buffered I/O” (ex: class java.io.BufferedWriter, class java.io.BufferedReader) We have to be care about the message’s format.(fixed format or XML formt) Please don’t use “n” as a message’s end! Please remember “Base64” format when you send binary messages.9 Reference: yen3’s blog – File I/O (1) , (2) Binary File, (3) XML 9 http://en.wikipedia.org/wiki/Base64 . . . . . . Java Technicalities 45/58
  • 47. Library and Programming Java I/O Socket Programming Client – java.net.Socket Server – java.net.ServerSocket Usually, We use Socket Programming together with Multi-threading Programming in Server. Don’t forget “ThreadPool”(java.util.concurrent.Executors) . . . . . . Java Technicalities 46/58
  • 48. Library and Programming JDBC — Java Database Connectivity JDBC — Java Database Connectivity an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. Reference: Wiki: Java Database Connectivity Reference: caterpillar: Java (JDBC) How To use? . . . . . . Java Technicalities 47/58
  • 49. Library and Programming JDBC — Java Database Connectivity JDBC Example: MySQL Please install MySQL. XD Please download MySQL Connector/J 5.1, the offical JDBC driver, you will get a “jar” file. In Eclipse, press “Add External JARs...”, choose the file you downloaded. Have fun! . . . . . . Java Technicalities 48/58
  • 50. Library and Programming JDBC — Java Database Connectivity JDBC Example: Java and MySQL For Example: List a table public void testMySQL(){ String driver = "com.mysql.jdbc.Driver"; String serverName = "localhost"; String databaseName = "information_schema"; String tableName = "TABLES"; String user = "yourname"; String password = "yourpassword"; String url = "jdbc:mysql://"+ serverName +"/" + databaseName; . . . . . . Java Technicalities 49/58
  • 51. Library and Programming JDBC — Java Database Connectivity JDBC Example: Java and MySQL For Example: List a table try { Class.forName(driver); Connection conn = (Connection) DriverManager.getConnection(url, user, password); Statement stmt = (Statement) conn.createStatement(); ResultSet result = stmt.executeQuery("SELECT * FROM" + " " + tableName); while (result.next()) { int numColumns = result.getMetaData().getColumnCount(); for (int i = 1; i <= numColumns; i++) { System.out.println("COLUMN " + i + " = " + result.getObject(i)); } } conn.close(); } catch(ClassNotFoundException e) { System.out.println("Can not find JDBC driver"); } catch (SQLException e) { e.printStackTrace(); } } . . . . . . Java Technicalities 50/58
  • 52. Conclusion Conclusion Conclusion We go through Java from different parts, especially from C/C++. We go through some Java Library ... There are a lot of examples. Please review it. XD Java is a noun-kingdom XDXD. (What do you think about when seeing “ArrayIndexOutOfBoundsException” first time?) Please love “Eclipse IDE” when developing Java programs. XD Let’s expect the interesting issue next week . XD . . . . . . Java Technicalities 51/58
  • 53. Conclusion Conclusion Do you have any problem ? I am glad you have listened the slides from start to now. XD . . . . . . Java Technicalities 52/58
  • 54. Conclusion Reference Reference — Website Java SE Documentation – http://java.sun.com/javase/downloads/index.jsp Eclipse.org – http://www.eclipse.org – http://caterpillar.onlyfun.net/Gossip/ C++ Boost Library – http://www.boost.org SGI STL – http://www.sgi.com/tech/stl/ TIOBE Software: Tiobe Index – http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html . . . . . . Java Technicalities 53/58
  • 55. Conclusion Reference Reference — Java Thinking in Java 4/e, Bruce Eckel, ISBN: 0131872486 The Java Programming Language 4/e, Ken Arnold, James Gosling, David Holmes , ISBN: 0321349806 Effective Java 2/e, Joshua Bloch, ISBN: 0321356683 Practical Java(TM) Programming Language Guide, Peter Haggar, ISBN: 0201616467 The Art of Java, Herbert Schildt, James Holmes, ISBN: 0072229713 Java Network Programming 3/e, Elliotte Rusty Harold, ISBN: 0596007213 Java Swing 2/e, James Elliott, Robert Eckstein, Marc Loy, David Wood, Brian Cole, ISBN: 0596004087 . . . . . . Java Technicalities 54/58
  • 56. Conclusion Reference Reference — Object Oriented Analysis/ Design/ Programming Object-Oriented Analysis and Design with Applications 3/e, Grady Booch, Robert A. Maksimchuk, Michael W. Engel, Bobbi J. Young, ISBN: 020189551 Design Patterns: Elements of Reusable Object-Oriented Software, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, ISBN: 0201663612 Refactoring: Improving the Design of Existing Code, Martin Fowler, Kent Beck, John Brant, William Opdyke, don Roberts, ISBN: 0201485672 Refactroing to Pattens, Joshua Kerievsky, ISBN: 0321213351 Agile Software Development, Principles, Patterns, and Practices, Robert C. Martin . . . . . . Java Technicalities 55/58
  • 57. Conclusion Reference Reference — C/C++ and Other Real World Haskell, Bryan O’Sullivan, John Goerzen, Don Stewart, ISBN: 0596514980 The C++ Programming Language 3/e, Bjarne Stroustrup, ISBN: 0201700735 The C Programming Language 2/e, Brian W. Kernighan, Dennis M. Ritchie, ISBN: 0131193716 C++ Primer 4/e, Stanley B. Lippman, Josée Lajoie, and Barbara E. Moo, ISBN: 0201721481 Effective C++ 3/e: 55 Specific Ways to Improve Your Programs and Designs, Scott Meyers, ISBN: 0321334876 Generic Programming and the STL: Using and Extending the C++ Standard Template Library, Matthew H. Austern, ISBN: 0201309564 . . . . . . Java Technicalities 56/58
  • 58. Conclusion Reference Appendix A: How to get a html String For Example: How to get a html String public String getHtmlString(String inputUrl){ try{ URLConnection url = (new URL(inputUrl)).openConnection(); BufferedReader br = new BufferedReader( new InputStreamReader(url.getInputStream())); int length=-1; StringBuffer sb = new StringBuffer(); char[] temp = new char[1024]; while((length=br.read(temp, 0, 1024))!= -1){ sb.append(temp, 0, length); } br.close(); return sb.toString(); }catch (MalformedURLException ex) { System.err.println(inputUrl + "is not parseable URL"); }catch (IOException ex) { System.err.println(ex); } return null; } . . . . . . Java Technicalities 57/58
  • 59. Conclusion Reference Appendix B: How to write Java Program Please install “Java Developer Kit(JDK)” and “Java Runtime Environment” Please set “PATH” and “CLASSPATH” in Windows. You can download “Eclipse” as your default Java Develop IDE. Have fun! . . . . . . Java Technicalities 58/58