Every Java program:
- must have a class
- starts from the main method
- all code is within classes
Interfacing with Java classes
- Protege export
- Clojure
- Org-mode code blocks
- EMF – Ecore
- Jena
- JSON API for WordPress?
To run our program, the main method must be identical to this signature
public static void main(String[ ] args)
A method is a collection of statements grouped together for an operation
Aka functions
/* This is also a
comment spanning
multiple lines */
/** This is a documentation comment */
/** This is also adocumentation comment */
Javadoc is a tool which comes with JDK and it is used for generating Java code documentation in HTML format from Java source code which has required documentation in a predefined format.
When a documentation comment begins with more than two asterisks, Javadoc assumes that you want to create a “box” around the comment in the source code. It simply ignores the extra asterisks.
/**********************
This is the start of a method
***********************/
Variables store data for processing.
A variable is given a name (or identifier), such as area, age, height, and the like. The name uniquely identifies each variable, assigning a value to the variable and retrieving the value stored.
Variables have types. Some examples:
– int: for integers (whole numbers) such as 123 and -456
– double: for floating-point or real numbers with optional decimal points and fractional parts in fixed or scientific notations, such as 3.1416, -55.66.
– String: for texts such as “Hello” or “Good Morning!”. Text strings are enclosed within double quotes.
You can declare a variable of a type and assign it a value. Example:
String name = “Jason”;
This creates a variable called name of type String, and assigns it the value “Jason”.
You can use a comma-separated list to declare more than one variable of the specified type. Example:
int a = 42, b = 11;
{
System.out.println(“Hello World!”);
}
public class ExampleProgram {
public static void main(String[ ] args) {
System.out.println(“Hello World”);
}
}
# State of the file system