background preloader

Java

Facebook Twitter

JavaCertification

Javacertification. The Java™ Tutorials. The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications.

The Java™ Tutorials

They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into "trails". The Java Tutorials primarily describe features in Java SE 8. For best results, download JDK 8. What's New The Java Tutorials are continuously updated to keep up with changes to the Java Platform and to incorporate feedback from our readers.

This release of the tutorial corresponds to the JDK 8u101 release. Two new processing limit properties, entityReplacementLimit and maxXMLNameLimit, have been added to JAXP. Trails Covering the Basics These trails are available in book form as The Java Tutorial, Sixth Edition. Creating Graphical User Interfaces Creating a GUI with Swing — A comprehensive introduction to GUI creation on the Java platform.Creating a JavaFX GUI — A collection of JavaFX tutorials.

Specialized Trails and Lessons. Java ejemplo de. Java recurss. Lesson: Exceptions (The Java™ Tutorials > Essential Classes) The Java programming language uses exceptions to handle errors and other exceptional events.

Lesson: Exceptions (The Java™ Tutorials > Essential Classes)

This lesson describes when and how to use exceptions. What Is an Exception? An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. The Catch or Specify Requirement This section covers how to catch and handle exceptions. How to Throw Exceptions This section covers the throw statement and the Throwable class and its subclasses. The try-with-resources Statement This section describes the try-with-resources statement, which is a try statement that declares one or more resources. Enum Types (The Java™ Tutorials > Learning the Java Language > Classes and Objects) An enum type is a special data type that enables for a variable to be a set of predefined constants.

Enum Types (The Java™ Tutorials > Learning the Java Language > Classes and Objects)

The variable must be equal to one of the values that have been predefined for it. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week. Because they are constants, the names of an enum type's fields are in uppercase letters. In the Java programming language, you define an enum type by using the enum keyword.

For example, you would specify a days-of-the-week enum type as: public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } You should use enum types any time you need to represent a fixed set of constants. Here is some code that shows you how to use the Day enum defined above: The output is: Mondays are bad. Java programming language enum types are much more powerful than their counterparts in other languages. Final. Final means, this value won’t be changed hereafter.

final

Advantages of using final final is one of the most under-used features of Java. Whenever you compute a value and you know it will never be changed subsequently put a final on it. Why? Final lets other programmers (or you reviewing your code years later) know they don’t have to worry about the value being changed anywhere else.If you get in the habit of always using final, when it is missing, it warns people reading your code there is a redefinition of the value elsewhere.final won’t let you or someone else inadvertently change the value somewhere else in the code, often by setting it to null. final helps prevent or flush out bugs. If I were redesigning Java, I would make all variables final by default. Final contexts. Top Ten Errors Java Programmers Make. (How to spot them.

Top Ten Errors Java Programmers Make

How to fix/prevent them.) By David Reilly Whether you program regularly in Java, and know it like the back of your hand, or whether you're new to the language or a casual programmer, you'll make mistakes. It's natural, it's human, and guess what? You'll more than likely make the same mistakes that others do, over and over again. 10.

Many programmers, particularly when first introduced to Java, have problems with accessing member variables from their main method. MyApplication.main ( command_line_args ); This means, however, that there isn't an instance of MyApplication - it doesn't have any member variables to access! Public class StaticDemo { public String my_member_variable = "somedata"; public static void main (String args[]) { // Access a non-static member from static method System.out.println ("This generates a compiler error" + my_member_variable ); } }