Skip to content

Programming Articles

  • HOME
  • Python
  • JavaScript
  • C/C++
  • Java
  • Terms & Conditions and Privacy Policy
  • About US
Main Menu

Java

Java / Programming

What is the difference between process and thread?

The major difference between process and thread is that threads (of the same process) run in shared memory space, while processes run in separate memory spaces. Let’s learn more about …

What is the difference between process and thread? Learn More
Java

How to generate a random alpha-numeric string in Java?

Algorithm To generate a random string, concatenate characters drawn randomly from the set of acceptable symbols until the string reaches the desired length. Implementation Here’s some fairly simple and very …

How to generate a random alpha-numeric string in Java? Learn More
Java

Does Java support default parameter values?

Sample query: I came across some Java code that had the following structure: I know that in C++ I can assign a parameter a default value. For example: Does Java …

Does Java support default parameter values? Learn More
Java

What is the main difference between an inner class and a static nested class in Java?

In this article, we’ll discuss the main difference between an inner class and a static nested class in Java. From the Java Tutorial: Nested classes are divided into two categories: static …

What is the main difference between an inner class and a static nested class in Java? Learn More
Java

How to break out of nested loops in Java?

Technically the correct answer is to label the outer loop. In practice if you want to exit at any point inside an inner loop then you would be better off …

How to break out of nested loops in Java? Learn More
Java

Top Java Programming Interview Questions

What is Java?  Java is the high-level programming language that was developed by James Gosling in the year 1982. It is based on the principles of object-oriented programming and can …

Top Java Programming Interview Questions Learn More
Java

How to create a generic array in Java?

You can do this: This is one of the suggested ways of implementing a generic collection in Effective Java; Item 26. No type errors, no need to cast the array repeatedly. However this …

How to create a generic array in Java? Learn More
Java

How to convert an ArrayList object to a String[] array in Java?

For example: The toArray() method without passing any argument returns Object[]. So you have to pass an array as an argument, which will be filled with the data from the list and returned. …

How to convert an ArrayList object to a String[] array in Java? Learn More
Java

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do?

From the community documentation: hibernate.hbm2ddl.auto Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is …

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do? Learn More
Java

How can I initialize a static Map in Java?

The instance initialiser is just syntactic sugar in this case, right? I don’t see why you need an extra anonymous class just to initialize. And it won’t work if the …

How can I initialize a static Map in Java? Learn More
Java

How to initialize a static Map in Java?

Sample query: How would you initialise a static Map in Java? Method one: static initialiserMethod two: instance initialiser (anonymous subclass) or some other method? What are the pros and cons of each? …

How to initialize a static Map in Java? Learn More
Java

Can’t execute jar- file: “no main manifest attribute” | Java [Answered]

Problem statement: I have installed an application, when I try to run it (it’s an executable jar) nothing happens. When I run it from the commandline with: java -jar “app.jar” …

Can’t execute jar- file: “no main manifest attribute” | Java [Answered] Learn More
Android / Java

Android SDK installation doesn’t find JDK? [Solved]

Sample query: I’m trying to install the Android SDK on my Windows 7 x64 System. jdk-6u23-windows-x64.exe is installed, but the Android SDK setup refuses to proceed because it doesn’t find the JDK installation. Is this …

Android SDK installation doesn’t find JDK? [Solved] Learn More
Java / JSON

How to parse JSON in Java?

The org.json library is easy to use. Just remember (while casting or using methods like getJSONObject and getJSONArray) that in JSON notation [ … ] represents an array, so library will parse it to JSONArray { … …

How to parse JSON in Java? Learn More
Java

How to get the current working directory in Java?

In Java, the current working directory can be found using the following code: Code : This will print the absolute path of the current directory from where your application was …

How to get the current working directory in Java? Learn More
Java

How to add elements to a hashmap in Java?

Use the put() method to add elements to a HashMap in Java. In this post, we’ll learn more than just how to add elements to a HashMap in Java. How …

How to add elements to a hashmap in Java? Learn More
Formatted Codes / Java

How to convert a String to int in Java?

Query: My String contains only numbers, and I want to return the number it represents. For example, given the string “1234” the result should be the number 1234. In this post, I’ll convert …

How to convert a String to int in Java? Learn More

Posts navigation

1 2 … 4 Next

Featured Posts

From UNIX to Linux – History of Linux

21st November 202010th September 2022

Best themes for Ubuntu: Make Ubuntu Beautiful

20th October 202010th September 2022

Strings in Python

12th September 202010th September 2022

Is Python hard to learn? Top best learning resources

18th April 202010th September 2022

Recent posts

  • How to pad a string with zeroes to the left?
  • What is the difference between process and thread?
  • How to generate a random alpha-numeric string in Java?
  • How to auto-resize an image to fit a ‘div’ container?
  • How to get a Docker container’s IP address from the host?
  • How to display a JavaScript object?
Copyright © 2023 Programming Articles.
Powered by WordPress and HitMag.