Category «Java»

Day5 of #100DaysOfCode Challenge: Factory Pattern in Java

In programming, Factory Pattern can be describe as object builder and one of the best example for this is Vehicle Factory were we will build a vehicle according to ordered type. example: Step 1: Create your abstract Vehicle class and define its properties. You can also use Interface.

Step 2: Create Car vehicle class …

Day4 of #100DaysOfCode Challenge: Sorting the java.util.List

Sorting the items in the list is as simple as below example.

Output: AE G B AE C A — A AE AE B C G

Java is Both Pass-By-Reference and Pass-By-Value, However

Yes you heard that right, Java works on Pass-By-Reference and Pass-By-Value but there is a twist and this makes a lot of confusion. Before I start trying to prove that Java is both, lets start this by understanding these two concepts. Pass-By-Reference – the caller and callee shares the same variable. A good explanation from …

JDK and JRE File Structure

This document gives an overview of the JDK directories and the files they contain. This page may also be used as a reference for the file structure of the JRE. To see the file structure of the Runtime Environment, just look at the description of the contents of the JDK’s jre directory on this page. …

How To Learn Java In Easy and Simple Steps?

1. Learn how to setup your computer to run java programs. http://programmingstacks.com/blog/self-study-in-java-programming/ 2. Take and glance on how to create your first java program. http://programmingstacks.com/blog/create-helloworld-java-program/

Using the this Keyword

Within an instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called. You can refer to any member of the current object from within an instance method or a constructor by using this. Using this with a Field The most common reason …

How to get Java System Properties?

The following table describes some of the most important system properties Key Meaning “file.separator” Character that separates components of a file path. This is “/” on UNIX and “\” on Windows. “java.class.path” Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified …