Home » Author Archives: Mary Zheng

Author Archives: Mary Zheng

Mary Zheng
Mary has graduated from Mechanical Engineering department at ShangHai JiaoTong University. She also holds a Master degree in Computer Science from Webster University. During her studies she has been involved with a large number of projects ranging from programming and software engineering. She works as a senior Software Engineer in the telecommunications sector where she acts as a leader and works with others to design, implement, and monitor the software solution.

Java Math Operators and Math Class Tutorial

In this tutorial, I will demonstrate how to perform the mathematic operations via the build-in Math operators and the Java Math class. Table Of Contents 1. Introduction 2. Technologies Used 3. Maven Project 3.1 Dependency 3.2 Java Object 3.3 Java Object Has Equals Method 4. Arithmetic Operators 4.1 Addition Operator 4.2 Subtraction Operator 4.3 Increment Operator 4.4 Decrement Operator 4.5 ...

Read More »

Java Collections Tutorial

1. Introduction A collection is a group of objects and treated as a single unit. It is used to store, retrieve, and manipulate aggregate data. Java has provides a collection framework which contains interfaces, classes, and algorithms since version 1.2 and enhanced it over the time. Here are some enhancements: Major enhancement at version 5, including generic type.Added more interfaces ...

Read More »

Apache Commons BeanUtils Example

1. Introduction Apache Common BeanUtils is one of the most common Java library. The latest version at the time of writing is 1.9.3 and published at September 26, 2016. BeanUtils provides utility methods for populating JavaBeans properties. In this example, I will demonstrate the following methods: static Object cloneBean(Object bean) – Clones a bean even if the bean class does ...

Read More »

Java System.in System.out System.error Example

1. Introduction In this post, we feature a comprehensive article on Java System.in System.out System.error. Java has provided java.lang.System class since version 1.0. The System class contains a static System.in for the standard keyboard input, static System.out for the system console output, and static System.err for error output streams to the system console. Here are the definitions: static InputStream in - ...

Read More »

Printf Java Example

1. Introduction In this post, we feature a comprehensive printf Java Example. Java PrintStream class has provided the printf method to write a formatted string to the PrintStream object since version 5. Here are the method’s signatures: public PrintStream printf(Locale l, String format, Object... args) public PrintStream printf(String format, Object... args) l – a locale to apply during formattingformat – ...

Read More »

Java Interfaces Example

1. Introduction In this post, we feature a comprehensive article on Java Interfaces. Java interface is an abstract type that defines methods that classes must implement. It can contain constants, abstract method signatures, default methods along with an implementation body, static methods along with an implementation body, and nested types. Java Interface defines the “contracts” and represents the IS-A relationship. ...

Read More »

Java Binary Search Tree Example

1. Introduction A binary tree is a recursive data structure where each node can have at most two children. A binary search tree (BST) is a special type of binary tree which has the following properties: The left sub-tree of a node contains the nodes with the key’s value lesser than itself.The right sub-tree of a node contains the nodes ...

Read More »

TestNG Creating Selenium Scripts Example

1. Introduction In this post, we feature a comprehensive article on TestNG Creating Selenium Scripts. TestNG is an open-source automated testing framework for Java unit testing which is inspired by both JUnit and NUnit. It supports the following unit testing features: It provides a suite of annotations: @BeforeClass, @AfterClass, @BeforeMethod, @AfterMethod, @Test, etc.It bundles test classes with xml files.@Test attributes are ...

Read More »

Java New Line Character Example

1. Introduction In this post, we feature a comprehensive article on Java New Line Character. A new line character is a character which marks the end of a text line and the beginning of a new line. According to the ASCII table, there are two control characters which represent a new line: LF – represents “NL line feed, new line”CR ...

Read More »

Java CompletableFuture Example

1. Introduction In this post, we feature a comprehensive article on Java CompletableFuture. Asynchronous operations are common in Java applications. There are lots of challenges when dealing with asynchronous operations, such as memory leaking, race condition, callback hell, disjointed error handling, etc. Java has provided the CompletableFuture<T> class to ease these challenges since version 8. It has about 50 methods ...

Read More »