Tag Archives: java

(Java) Operational System Validator

Check which operating system the program is running. The program explains itself.

Posted in Java | Also tagged , , , , | Leave a comment

(Java) Java inheritance example

This example demonstrates advanced object-oriented concepts including inheritance, getters/setters, method overloading and reflection.

Posted in Java | Also tagged , , , , , | Leave a comment

(Java) Java data structures example

This example demonstrates intermediate object-oriented programming concepts including Data Structures, Linked Lists and how method overriding works. In addition, it demonstrates how to document code properly, with ample comments and proper Javadocs which can generate corresponding code API docs.

Posted in Java | Also tagged , , , , | Leave a comment

(Java) Quicksort in Java, with Enforced Suckitude

It’s no fun implementing QuickSort unless you can force it out of its blister-fast, O(n log n) speed and humiliate it with its worst-case, O(n^2) runtime. So that’s what I set out to do. My naive partition simply pivots around the low item, but my randomized partition defeats the sucky inputs by choosing a random [...]

Posted in Java | Also tagged , , , , , | Leave a comment

(Java) Fun with Fibonacci, Golden Ratio and Factorials, with loops vs recursives

 

Posted in Java | Also tagged , , , , , , , | Leave a comment

(Java) Make Simple HTTP Request and Put Response in String

This snippet shows how to do a simple lightweight HTTP request in Java and place the response content in a String.

Posted in Java | Also tagged , , , , | Leave a comment

Creating a robot in Java with Robocode

Robocode is a programming game where you get to build a robot to battle with other robots. It supports the Java programming language and the .NET framework. We will use the Java programming language in this example.

Posted in Java | Also tagged , , , , | Leave a comment

Parsing XML in Java

There are several methods available for parsing an XML file. Some parsers transform the XML file into a traversable DOM tree. The tree consists of a root node and one or more child nodes belonging to the root node. These child nodes are able have child nodes of their own and so forth. Nodes without children [...]

Posted in Java | Also tagged , , , , , , , | Leave a comment

Console output in Java

System.out.println can be used for outputting a line to the console. public void Foo { System.out.println(“Bar”); }

Posted in Java | Also tagged , , , , | Leave a comment