サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
アメリカ大統領選
examples.javacodegeeks.com
Ima MiriJanuary 20th, 2016Last Updated: February 19th, 2019 In this tutorial, we are going to discuss about SpringMVC Interceptor. First, we discuss about Spring MVC architecture and where an interceptor is invoked in this architecture, then we have a look at the implementation of interceptor in more details. 1. Overview of Spring MVC ArchitectureSpring’s web MVC framework is request-driven and de
Redis is an in-memory key/value store. It is used as a database, cache and message broker. In this article, we will see some examples of Spring Data Redis. Before we get to start with the examples, we need to first install Redis and configure the server. 1. Overview of RedisRedis is an extremely high-performance, lightweight key/value based data store. It provides several operations like persisten
Chandan SinghSeptember 23rd, 2015Last Updated: March 19th, 2019 In this example, we will demonstrate how we can create and maintain PDF Files using ITEXT 1. Why use PDF?PDF stands for Portable Document Format, was a proprietary file format owned by Adobe Systems. However, it was released as an open standard in July, 2008. The PDF format is independent of the underlying software and hardware of the
This article introduces the FileLock class and its basic usage. This article examples show using file locks with FileChannels. The examples in this article are compiled and run in Windows OS environment. Note that Java SE 7 is required to run the code. 1. IntroductionFileLock is a token representing a lock on a region of a file. This is an abstract class defined in the java.nio.channels package. 1
In this article, we are going to show how to use the new Java 8 Optional – java.util.Optional class. 1. IntroductionThe null reference is a very common problem in Java, everybody got once a NullPointerException because some variable or input parameter was not properly validated. In Java, null, can have a logical value and a meaning; so it is important to take it into consideration and do not ignor
Anirudh BhatnagarNovember 21st, 2014Last Updated: November 21st, 2014 In this example we will see how and when to use java.util.TreeSet. A TreeSet is a set implementation which provides total ordering on its elements. The elements are ordered using their natural ordering, or by a Comparator typically provided at sorted set creation time. A TreeSet is typically used when we want to keep the element
Dani BuizaNovember 20th, 2014Last Updated: February 25th, 2019 The way java.util.HashMap entries are indexed and stored has changed in the Java 8 update. Hash elements use balanced trees instead of linked lists under certain circumstances now. All these is what this article is about. The main idea is that when the number of items in a hash is larger than a certain value, the hash will change from
In this article, we will discuss the implementation of Quicksort Java algorithm. Quicksort is the most widely used sorting algorithm. Quick sort is faster than most other common sorting algorithms. It was developed by the famous Computer Scientist Tony Hoare and it is based on the Divide and Conquer Algorithm. First, we are going to explain how Quick sort works on an algorithmic level, with some s
In this article we will discuss about the Collections class and some of its important methods. The class java.util.Collections is a utility class that resides in java.util package, it consists entirely of static methods which are used to operate on collections like List, Set. Common operations like sorting a List or finding an element from a List can easily be done using the Collections class. We
In this example we will show how to use java.text.SimpleDateFormat class so as to format date into text or parse text into date. SimpleDateFormat extends the java.text.DateFormat class which is an abstract class for date/time formatting subclasses and provides many class methods for obtaining default date/time formatters based on any given locale. We will see the usage of the class DateFormat, too
In this example we will show how to open and read a file in Java. There are many ways to do this, but we will show two of them. For this example, we will read the contents of a text file named “test_file.txt”. 1. Read a file using BufferedReaderThis is the most commonly-used method in order to read a file in Java. BufferedReader reads text from a character-input stream, buffering the characters fo
In this example, we are going to look at the PrintWriter class in Java. We will create a printwriter java example and we will print some common data types to the standard output as well as to a file using PrintWriter class. 1. What is the Java PrintWriter classJava provides the PrintWriter class to print formatted and human-readable data in a stream. This class implements all the print methods fou
In this tutorial, we will explain the Calendar class in Java – java.util.Calendar using an example. 1. Introduction The Calendar is an abstract class that provides methods for converting between time and calendar fields. Also, the class provides fields and methods for implementing a concrete calendar system. The Calendar field values can be set by calling the following methods: set, add and roll.
In this post, we feature a comprehensive StringBuilder Java Example. StringBuffer in Java is the same as StringBuilder, but the first is thread-safe. At the end of this article, we will create an abstract TestBase class which shows StringBuffer ‘s common methods. 1. IntroductionStringBuilder object seems like a String object but with the characteristics of an array. Every object of this type is li
Java Reflection API provides the ability to inspect and modify the runtime behavior of applications. Using reflection we can inspect a class or an interface, get their constructors, methods, and fields information at runtime even though the class is not accessible at compile time. We can also use reflection to instantiate an object, invoke it’s methods, change field values. The classes of Reflec
The Java Deployment Toolkit allows developers to easily deploy their applets and applications to a large variety of clients. The Deployment Toolkit script is a set of JavaScript functions that, help developers deploy their rich Internet applications (RIAs) consistently across various browsers and operating system configurations. The script evaluates the underlying browser and operating system, and
In this example, we will explain the array definition and we will show the range of functionality provided by the Java arrays class: java.util.Arrays. This class of the java.util package contains several static methods that you can use to compare, sort, and search in arrays. In addition, you can use this class to assign a value to one or more elements of an array. This class is a member of the Col
In this example we are going to see how to use @Test annotation along with its optional parameter expected in JUnit testing framework. Also, we will see how to run our test case from the command line by using the org.junit.runner.JUnitCore. 1. Create the java class to be tested Create a folder named JUnitExceptions. This is the folder where your classes will be located. Using a text editor, create
In this example we are going to talk about FileOutputStream. FileOutputStream is a subclass of OutputStream, which is used to transfer data from your program to a resource. And in this case to a file that resides in your underlying file system. OK, so let’s start with some simple examples. 1. Writing bytes to a fileLet’s see how you can obtain a FileOutputStream and write bytes to a file. FileOutp
Do you want to know how to develop your skillset to become a Java Rockstar?
このページを最初にブックマークしてみませんか?
『Java Code Geeks』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く