Java

Here’s an index of all Java specific articles on Programming.Guide.

Java Arrays

  1. Java Arrays (with examples)
  2. Maximum length of array
  3. Arrays vs ArrayLists (and other Lists)
  4. Matrices and Multidimensional Arrays
  5. Appending to an array
  6. Copying an array
  7. Inserting an element in an array at a given index
  8. Testing array equality

Types in Java

  1. Java Basics: Types
  2. Primitive Types
  3. Primitives vs Objects and References
  4. Ranges of Primitive Types
  5. Wrapper Types
  6. Autoboxing and unboxing
  7. Boxed values and equality
  8. No byte or short literals?
  9. Byte (class) vs byte (primitive)
  10. Short (class) vs short (primitive)
  11. Integer vs int
  12. Long (class) vs long (primitive)
  13. Float (class) vs float (primitive)
  14. Double (class) vs double (primitive)
  15. Character vs char
  16. Boolean (class) vs boolean (primitive)

Java Keywords

  1. catch
  2. finally
  3. throw
  4. throws
  5. try

Java Exceptions

  1. Throw, Try and Catch
  2. Java Exception Types
  3. Chained Exceptions
  4. Custom Exception
  5. Difference between Checked and Unchecked Exceptions
  6. Choosing between Checked and Unchecked Exceptions
  7. Checked Exceptions: Good or Bad?
  8. Return Values vs Exceptions
  9. try + finally
  10. try-with-resources
  11. Stack Traces
  12. Suppressed Exceptions
  13. throw vs throws vs Throwable
  14. List of Java Exceptions

Loops in Java

  1. while loop
  2. for loop
  3. for each loop
  4. do…while loop
  5. break
  6. continue
  7. Beware of accidental semicolons in while and for loops!

Miscellaneous Java Articles

  1. Abstract interfaces and abstract interface methods
  2. Why can I access private fields of other objects?
  3. Accessing private fields of superclass through reflection
  4. Accessing private fields through reflection
  5. AtomicInteger and equals / Comparable
  6. Class.this explained
  7. Clone and Cloneable
  8. Convert enum to and from int
  9. Convert enum to and from string
  10. Converting a char to an int
  11. Copying Objects
  12. Creating a custom event
  13. Difference between a.getClass() and A.class
  14. Do interfaces inherit from Object?
  15. Drawing multiline strings with Graphics
  16. What is effectively final?
  17. Ellipsizing strings
  18. Collections.emptyList vs new ArrayList
  19. Executing code in comments?!
  20. What does final mean, and are final variables always immutable?
  21. Formatting byte size to human readable format
  22. Function Pointers in Java
  23. Functional Interfaces
  24. Generating a random char (a-z)
  25. Generating a random number of a certain length
  26. Generating a random String (password, booking reference, etc)
  27. Java Error: Generic array creation
  28. Handling InterruptedException
  29. How does the assert keyword work?
  30. Java2D: Increasing line width
  31. Initialize list with zeroes
  32. Why's Double.MIN_VALUE is positive? Integer.MIN_VALUE is negative!
  33. Is it wrong to use deprecated methods or classes?
  34. Where's the javadoc for values and valueOf methods on enums?!
  35. Lambda Cheat Sheet
  36. <...> (less than/greater than) syntax
  37. Local methods (or submethods, or inner methods, or nested methods)
  38. Using C style macros in Java
  39. Marker Interfaces
  40. N-gram generation
  41. Finding the Nth occurrence of a substring in a String
  42. Find number of regex matches in a String
  43. Opening a URL in Android's web browser from within application
  44. 5 Java concepts explained: Overloading, overriding, shadowing, hiding, and obscuring
  45. Why you should always override hashCode when overriding equals
  46. Does Java use Pass-by-Value or Pass-by-Reference?
  47. Passing a list as argument to a vararg method
  48. Print 2D Matrix
  49. Print null
  50. Random with a random seed
  51. Reading the Nth line from a file
  52. Remainder (modulo) operator with negative numbers
  53. Removing trailing comma from comma separated string
  54. Removing a range of elements from a list
  55. Remove duplicate whitespace in strings
  56. Removing elements from multiple indexes in a list
  57. How to split a String into an ArrayList
  58. Java Stack Traces: Unknown Source
  59. Java Oddity: How an upcast can save the day
  60. Java Variables (with examples)
  61. What exactly is immutable?
  62. When to create a final class
  63. When should I override equals?
  64. Why wait must be called in a synchronized block
  65. Wrong results for division?