Regex Boundary Matcher: Matching Begin-with / End-with
Java regex word boundary example. Use regular expression word boundaries to find matching lines which start with or end with a certain words.
“Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, etc. This is mostly to differentiate from others like Java ME or Java EE. “Core Java” is Oracle’s definition and refers to subset of Java SE technologies.
The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming, from desktop applications to Java EE applications.
Java regex word boundary example. Use regular expression word boundaries to find matching lines which start with or end with a certain words.
Java example of matching all common misspellings of any word in text content.
Learn how to delete a temporary file in Java. We will see examples to use File.deleteOnExit() and File.delete() methods.
Learn to create a temp file and directory in Java using the legacy and NIO classes. Also, learn to delete temp files or temp directories on JVM shutdown.
Learn to create a temporary file and write to it in Java. We will use the code sample used for creating a temporary file example.
Learn to check if a file exists or a directory exists in given path in Java. Also check is file is readable, writable or executable.
Java example to convert String to InputStream using ByteArrayInputStream and IOUtils classes. Writing String to InputSteam is a frequent job .
Learn reading data from files into a byte array in Java using NIO Files, FileInputStream, Commons IO FileUtils, and Guava ByteStreams classes.
Learn reading and writing UTF-8 content into a file using BufferedReader and BufferedWriter in Java.
Whenever we execute a Java program, a separate memory area is reserved for storing various parts of our application code which we roughly call JVM memory. Though not necessary, having some knowledge about the structuring of this memory area is quite beneficial. Knowing Java memory model becomes more important when …
Learn how to read CSV file and write data to CSV file in Java. We will use opencsv library which provide excellent support to work with CSV files in Java.
In HiLo game, we have to adjust our next guess such that we are able to guess the right number within six attempts. Learn with a Java program.
For reading a file line by line, the LineNumberReader class could be used that allows to keep track of which line we are currently processing.
Learn to read property file in java using Properties.load() method. Then we will use Properties.setProperty() method to write a new property into file,
Learn to read the user input from the console in Java and write to the console using Console, BufferedReader and Scanner with examples.
Java FileFilter accepts File objects and thus can be used to filter the files based on other attributes such as read-only, directory etc.
Learn to read or parse XML documents into String, write to files and convert to POJO using Java DOM parser API with examples.
Both DOM and SAX parsers are extensively used to read and parse XML files in java applications and both of them have their own set of advantages and disadvantages.
In this iText tutorial, we are writing various code examples to read a PDF file and write a PDF file. iText library helps in dynamically generating the .pdf files from Java applications. The given code examples are categorized into multiple sections based on the functionality they achieve. With each example, …
Most of the applications today, which are targeted at a larger audience e.g. internet users, usually deal in money as well. In such applications, a requirement will be to display money/currency in a format specific to that location or country. In this tutorial, I am giving some examples that will …
Learn to get the locale of the user in Java that is used to format the content according to the user’s demographics (geographical, political, or cultural information). 1. What is Locale? Suppose we are developing an application and we are asked to make the application customized for international end-users. To …
Deserialization in Java is the process by which the object previously serialized is reconstructed back into its original form i.e. object instance.
Learn about Java Generics PECS which is related to producing and consuming collections with easy-to-follow examples.
Learn the difference between method overloading and method overriding in java, which mainly involve method name, signature, parameters list and return type.
The Java transient keyword is used on class attributes/variables to indicate that serialization process of such class should ignore such variables while creating a persistent byte stream for any instance of that class. A transient variable is a variable that can not be serialized. According to Java Language Specification [jls-8.3.1.3] …
In computer architecture, 64-bit computing is the use of processors that have datapath widths, integer size, and memory addresses widths of 64 bits (eight octets/bytes). Also, 64-bit CPU and ALU architectures are those that are based on registers, address buses, or data buses of that size. From the software perspective, …
Java Generics is a technical term denoting a set of language features related to the definition and use of generic types and methods.
One of the best additions in java 5 was Atomic operations supported in classes such as AtomicInteger, AtomicLong etc. These classes help you in minimizing the need of complex (un-necessary) multi-threading code for some basic operations such as increment or decrement a value which is shared among multiple threads. These …
Reflection is one of those things like multi-threading where everyone with experience of it says “Don’t use it unless you absolutely have to”. Above quote is absolutely true for all for us alike. In my previous tutorial, I discussed basics of annotation in which I discussed the usage of reflection …
An annotation is a kind of metadata in Java that can be applied to various elements of Java source code so that later some tool, debugger, or application program can take advantage of these annotations; and help analyze the program in a positive and constructive way. Just to mention, we …
At entry level Java programmer, you can expect this interview question on Hashtable vs HashMap. Though the question becomes really easy when you know other concepts like how hashmap works, yet after getting a many queries from my blog readers who are preparing for or working at junior level, I …
ASCII (American Standard Code for Information Interchange) is a character encoding standard that assigns numerical values to characters. Each character is represented by a unique numerical value ranging from 0 to 127. Similarly, Hexadecimal (or hex) is a base-16 numbering system that uses 16 distinct symbols: 0-9 and A-F (or …
Multi-threading is very popular topic among interviewers from long time. Though I personally feel that very few of us get real chance to work on a complex multi-threaded application (I got only one chance in last 7 years), still it helps in having the concepts handy to boost your confidence …
Defining thread safety is surprisingly tricky. A quick Google search turns up numerous “definitions” like these: Thread-safe code is code that will work even if many Threads are executing it simultaneously. A piece of code is thread-safe if it only manipulates shared data structures in a manner that guarantees safe …
Learn to split a String with delimiters in Java using String.split(), StringUtils.split() and Splitter.split() APIs with examples.
Java fork-Join breaks the task at hand into subtasks until the subtasks are simple enough that they can be solved without further breakups.
The “java.exe” and “javaw.exe” are Java executables on the Windows platform used to launch the GUI and Text-based Java programs.
Java program to calculate age from date of birth using Java 8 localdate, period class, joda library and Java date, calendar classes.
1. Introduction In BlockingQueue and ThreadPoolExecutor example, we learned creating a CustomThreadPoolExecutor which had the following capabilities: Tasks are being submitted to the blocking queue. An executor picks up the task from the queue and execute them. It had overridden beforeExecute() and afterExecute() methods to perform pre-and-post activities if needed. …
Learn to use classes from Java IO, New IO and Commons IO to delete a directory including all the subdirectories and files in it.
If you are working on a web application and you define the taglibs in your web.xml file then you may encounter this exception. The exception trace in server console looks like this when you start up the server. Solution You just need to confirm the allowed tags by web.xml confirming …
Java Streams can be defined as a sequence of elements from a source that supports aggregate operations on them. The source refers to a collection or array.
Introduced in Java 8, a functional interface is simply an interface that has exactly one abstract method. Learn more about functional interfaces in this tutorial.
Java New input/output (NIO) was introduced with JDK 1.4. Picking up where Standard IO leaves, NIO provides high-speed, block-oriented IO to Java library. By defining classes to hold data, and by processing that data in blocks, NIO takes advantage of low-level optimizations in a way that the java.io package could …
Learn the difference between checked vs unchecked exceptions in Java, with simple explanations and examples. Learn Java exception handling best practices.
Learn to create a splash window using the Java SWT toolkit for Windows applications that need a delay during application loading and initialization.
Java labeled loops help in the case of nested loops when we want to break or continue a specific loop out of those multiple nested loops.
Learn to handle the exceptions thrown from the instance or static initializer blocks in Java by declaring them in constructors.
Java SerialVersionUID example. Learn to create generate serialVersionUID for classes to be serialized. Learn to change serialversionuid correctly.
Learn to convert InputStream to String using Google guava IO’s ByteSource and CharStreams, BufferedReader, Scanner, and IOUtils classes.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.