Java example

In this chapter, we will introduce Java Common examples , Through example learning, we can master Java Application of .

Java Environment settings instance

  1. Java example – How to compile a Java file ?
  2. Java example – Java How to run a compiled class file ?
  3. Java example - How to execute the specified class File directory (classpath)?
  4. Java example – How to view the current Java Running version ?

Java character string

  1. Java example – String comparison
  2. Java example - Find the last occurrence of the string
  3. Java example - Delete a character in the string
  4. Java example - String substitution
  5. Java example - String inversion
  6. Java example - String lookup
  7. Java example - String segmentation
  8. Java example - String segmentation (StringTokenizer)
  9. Java example - String lowercase to uppercase
  10. Java example - Test whether two string regions are equal
  11. Java example - String performance comparison test
  12. Java example - String optimization
  13. Java example - String formatting
  14. Java example - Connection string

Java array

  1. Java example – Array sorting and element search
  2. Java example – Add elements to the array
  3. Java example – Get array length
  4. Java example – Array inversion
  5. Java example – Array output
  6. Java example – Array to get the maximum and minimum values
  7. Java example – Array merge
  8. Java example – Array fill
  9. Java example – Array expansion
  10. Java example – Find duplicate elements in the array
  11. Java example – Delete array elements
  12. Java example – Array difference set
  13. Java example – Array intersection
  14. Java example – Find the specified element in the array
  15. Java example – Determine whether the arrays are equal
  16. Java example - Array Union

Java Time processing

  1. Java example - Format time (SimpleDateFormat)
  2. Java example - Get the current time
  3. Java example - Get year 、 Month, etc
  4. Java example - Time stamp is converted to time

Java method

  1. Java example – Method overload
  2. Java example – Output array elements
  3. Java example – Hanoi tower algorithm
  4. Java example – Fibonacci sequence
  5. Java example – Factorial
  6. Java example – Method overrides
  7. Java example – instanceOf Keyword usage
  8. Java example – break Keyword usage
  9. Java example – continue Keyword usage
  10. Java example – label (Label)
  11. Java example – enum and switch The statement uses
  12. Java example – Enum( enumeration ) Use of constructors and methods
  13. Java example – for and foreach Recycle
  14. Java example – Varargs Variable parameters use
  15. Java example – Overload (overloading) Method Varargs

Print graphics

  1. Java example – Print diamond
  2. Java example – Nine nine multiplication table
  3. Java example – Print triangles
  4. Java example – Print inverted triangles
  5. Java example – Print parallelogram
  6. Java example – Print rectangle

Java File operation

  1. Java example - File write
  2. Java example - Read the contents of the file
  3. Java example - Delete file
  4. Java example - Copy the contents of a file to another file
  5. Java example - Append data to file
  6. Java example - Create temporary file
  7. Java example - Modify the last modification date of the file
  8. Java example - Get file size
  9. Java example - File rename
  10. Java example - Set file read-only
  11. Java example - Check whether the file exists
  12. Java example - Create a file in the specified directory
  13. Java example - Get file modification time
  14. Java example - Create file
  15. Java example - File path comparison

Java Directory operation

  1. Java example - Create directory recursively
  2. Java example - Delete directory
  3. Java example - Determine whether the directory is empty
  4. Java example - Determine whether the file is hidden
  5. Java example - Get directory size
  6. Java example - Find files in the specified directory
  7. Java example - Get the parent directory of the file
  8. Java example - Get the last modification time of the directory
  9. Java example - Print directory structure
  10. Java example - Traverse all directories under the specified directory
  11. Java example - Traverse all files in the specified directory
  12. Java example - Find files in the specified directory
  13. Java example - Traverse the system root directory
  14. Java example - View the current working directory
  15. Java example - Traverse directory

Java Exception handling

  1. Java example - Exception handling method
  2. Java example - Multiple exception handling ( Multiple catch)
  3. Java example - Finally Usage of
  4. Java example - use catch Handling exceptions
  5. Java example - Multithreaded exception handling
  6. Java example - Get the stack information of the exception
  7. Java example - Overload method exception handling
  8. Java example - Abnormal chain test
  9. Java example - Custom exception

Java Data structure

  1. Java example – Number summation operation
  2. Java example – Use the stack to convert infix expressions to suffixes
  3. Java example – In the linked list (LinkedList) The beginning and end of
  4. Java example – Get linked list (LinkedList) The first
  5. Java example – Delete elements in linked list
  6. Java example – Get the elements of the linked list
  7. Java example – Get the index value of the vector element
  8. Java example – Stack implementation
  9. Java example – Linked list element lookup
  10. Java example – Press the stack out of the stack to realize string inversion
  11. Java example – Queue (Queue) Usage
  12. Java example – Get the maximum element of the vector
  13. Java example – Linked list modification
  14. Java example – Rotation vector

Java aggregate

  1. Java example – Array to collection
  2. Java example – Set comparison
  3. Java example – HashMap ergodic
  4. Java example – Set length
  5. Java example – Set out of order
  6. Java example – Set traversal
  7. Java example – Set inversion
  8. Java example – Deletes the specified element in the collection
  9. Java example – Read only collection
  10. Java example – Set output
  11. Java example – Set to array
  12. Java example – List Loop move element
  13. Java example – lookup List The maximum and minimum values in
  14. Java example – ergodic HashTable Key value of
  15. Java example – use Enumeration ergodic HashTable
  16. Java example – Add elements of different types to the collection
  17. Java example – List Element replacement
  18. Java example – List intercept

Java Network instance

  1. Java example – Gets the name of the specified host IP Address
  2. Java example – Check whether the port is used
  3. Java example – Get native ip Address and host name
  4. Java example – Get remote file size
  5. Java example – Socket Implement multithreaded server program
  6. Java example – View the last modification time of the file specified by the host
  7. Java example – use Socket Connect to the specified host
  8. Java example – Web crawling
  9. Java example – obtain URL Date information of response header
  10. Java example – obtain URL Response header information
  11. Java example – Parse URL
  12. Java example – ServerSocket and Socket Communication example

Java thread

  1. Java example – See if the thread is alive
  2. Java example – Get the current thread name
  3. Java example – Condition monitoring
  4. Java example – Thread priority setting
  5. Java example – Deadlock and its solution
  6. Java example – Get thread id
  7. Java example – Thread suspended
  8. Java example – Terminate thread
  9. Java example – producer / Consumer issues
  10. Java example – Get thread status
  11. Java example – Get all threads
  12. Java example – View thread priority
  13. Java example – Interrupt thread