Home » Java » Core Java

Core Java

Difference Between Java and JavaScript

1. Introduction We look at the comparison of Java vs JavaScript languages in this article. JavaScript was developed by Netscape. It was initially a scripting language for client-side and later used as a language for both client-side and server-side scripting. Java was developed by James Gosling form Sun Microsystems. JavaScript is used in the server in the form of node.js ...

Read More »

Learn Java from scratch with these easy steps

Java is one of the most popular programming languages for software development. Learning and mastering Java will open doors for you as a developer, no matter your end-goal or skill level. Today, we’re going to go over some reasons we think you should start learning Java and then offer an in-depth roadmap on how to get started. Why should I ...

Read More »

Java interview prep: 15 Java interview questions

Not all interviews will focus on algorithms and data structures — often times an interview will focus solely on the language or technology that you have claimed to be an expert in. In interviews like these, there usually aren’t any “gotcha” questions, instead they require you to draw on memory and your experience with the language — in other words, ...

Read More »

5 simple and effective Java techniques for strings and arrays

Java routinely hits inside the top five most popular programming languages and understandably so; it’s versatile, fairly easy to learn being that it’s a high-level language, and it satisfies a number of use cases. For these reasons, Java is a great language to learn whether you’re experienced or just starting out your software engineering career. Java may be a relatively ...

Read More »

Managing multiple Java installations

With more and more Java releases coming up, it’ll be more interesting to manage multiple Java installations on your local environment. Different projects may require different Java versions. The jenv project is a convenient way how to manage Java installations. It can setup local Java installations on global, directory and shell level and uses easy-to-remember Java version identifiers: $> jenv ...

Read More »

Repeated code

Introduction It is usually not good to have copy/paste code in our Java application but sometimes it is unavoidable. For example the project License3j provides a method isXXX in the Feature class for each XXX type it supports. In that case, we can do no better than write 01 02 03 04 05 06 07 08 09 10 11 12 ...

Read More »

First Past the Post

Often, we write code to work out the first answer of a bunch of available ones. Let’s look at that in Java. 01 02 03 04 05 06 07 08 09 10 11 12 public Widget getAppropriateWidget(CustomerRequest request) {     if (shelfstock.contains(request.getBarcode()) {         return new ShelfWidget();     }     if (backroomStock.contains(request.getBarcode()) {         return new BackroomWidget();     }     if (supplier.contains(request.getEan()) {         return new SupplierWidget();     } ...

Read More »

[MEGA DEAL] Oracle Java Certification Exam Preparation Courses + Tests Training Bundle (92%)

Become a Certified Programmer with an Oracle Java Certification & Take a Step Ahead Toward a Brighter Development Career Hey fellow geeks, This week, on our JCG Deals store, we have another extreme offer. We are offering a massive 92% off on Oracle Java Certification Exam Preparation Courses + Tests Training Bundle. Get it now with only $29,99, instead of ...

Read More »

A Surprising Injection

So, I owe Jim an apology. He’d written a working mockito and JUnit test, and I told him in review that I didn’t think it did what he expected it to. While I was wrong, this scenario reads like a bug to me. Call it desirable unexpected side effects. Imagine you have the following two classes: 01 02 03 04 ...

Read More »