Java

How to use Java varargs

The three dots in a method parameter type is a feature called Java varargs. It was introduced in Java 5 and is formally known as variable arity methods or variadic functions.

Ways to program your drone to do awesome stuff

Drones, quadcopters, RS helicopters and other remote controlled crafts are hot topic these days. We programmers are more interested in how to program them to do something cool. Indeed, it’s become more and more easy.

Java quiz: Object Orientation

1. What is encapsulation:
a) the ability to make changes in your implementation without breaking the code of others
b) keep instance variables accessible foe everyone
c) create getters and setters rather then give direct access to instance variables

Java quiz: Declarations and Access

1. What is a Java program?
a) A collection of classes
b) A collection of objects talking to other objects by invoking each others methods
c) A template that describes the kinds of state and behavior that objects of its type support

2. Java components are:
a) types
b) classes
c) variables
d) objects
e) instances
f) methods

Hibernate: how to enable show sql

To see the SQL that your application sends to the database during the execution, insert the following property in your XML property file:

XPath examples – Hibernate java mapping

Those who use hibernate for database access know that you need to provide an information that this object is a hibernate object. To do so you typically need to annotate your object with @Entity. It’s not a problem although if we speak about some large system. In large systems we have typically a number of instances of the same object that represent the same table in different contexts and packages. And here we need this: to give each object unique name.
Example: