How to Send HTTP Request from Java Program - Example Tutorial

If you are thinking is it possible to send an HTTP request from a Java program and if yes, how to send a simple HTTP GET request in Java, then you have come to the right place. In this article, I'll show you how you can use the HttpURLConnection class from package to send a simple HTTP request in Java. But, first let me answer your first question, is it possible to send HTTP request in Java? Yes, it's possible and you can send any kind of HTTP request e.g. GET, POST, PUT, DELETE, HEAD, or PATCH. The package provides a class called HttpURLConnection, which can be used to send any kind of HTTP or HTTPS request from Java program.

How to add/remove new elements to an array in Java?

Java beginners often ask how to add new elements to an array? or how to remove elements from an array in Java? is that possible in Java? Well, no, it's not possible in Java because arrays length cannot be changed once created. Which means neither you can add new elements nor you can remove an old one. All you can do is that reassign values to the different bucket. For example, if you have a String array of length 3 e.g. {"java", "is", "great"} then you can just replace the individual index to make it like {"Python", "is", "great"} by replace "java" with "Python" at first index, but you cannot add or remove elements.

How to Create Random Alphabetic or AlphaNumeric String of given length in Java - Example

Suppose, you want to generate an alphabetic or alpha-numeric string of given length in Java? How do you do it? Well, if you are like me, you probably search a library e.g. Apache commons-lang for something which can do this task. It's a good thing. There is no point on re-inventing a wheel if a tried and tested solution already exists. In fact, Effective Java, the most respected book in Java world also suggest to know and use your library. In fact, Apache commons-lang does have a class called RandomStringUtils, which allows you to generate Random alphanumeric String in just one method call as shown below:


This works great for many practical purposes but if you are generating security sensitive identifier then this is not 100% secure.

5 Free Servlet, JSP, and JDBC Online Courses for Advanced Java Developers

If you are a Java developer working on a Java JEE projects e.g. Java web application or you want to get into that by learning server-side technologies like Servlet, JSP, and JDBC then you have come to the right place. In this article, I will share some free online courses to learn Servlet, JSP, and JDBC at your own pace. If you want to become a rockstar Java web developer then you must have a good understanding of these basic web technologies before you learn frameworks like Spring and Hibernate. These frameworks work on top of these basic technologies and if you don't know them then you would often struggle to debug and troubleshoot problems in real world.

3 Books and Courses to Learn RESTful Web Services using Spring and Java

Even though the Spring in Action 4th Edition is a good book to learn Spring framework, its not enough to learn intricacies of developing RESTful Web Service using Spring Frameowrk. It does have a chapter on developing RESTful Web Services and nicely explains concepts like @RestController, @ResponseBody, @ResponseStatus, HTTP message converters, content negotation but that barely touch the surface of developing a production quality RESTFul Web Service. There are many other things e.g. filtering, pagination, error handling, and security of RESTful Web services using Spring and Spring security which is not covered.

How to deal with Files and Directories in Java

The File API is one of the important parts of any programming language or API and even though Java's file API both new and old, are powerful, they are not intuitive enough compared to other languages e.g. Python. Apart from knowing the essential classes and abstractions e.g. File, InputStream, OutputStream, Reader, Writer, Channel etc, you also need to know and remember some nitty gritty detail to avoid subtle issues. There are many articles out there on the internet which can teach you how to read and write data from the file but there are very few which will tell you to do it in right way.

5 ways to Compare String Objects in Java - Example Tutorial

here are many ways to compare String in Java e.g. you can use equals() and equalsIgnoreCase() for equality check and compare() and compareTo() for ordering comparison. You can even use the equality operator == to perform reference based comparison e.g. to check both the String reference variable points to the same object. In general, equals() is used to check whether the value of given String is same i.e. they contain same characters in the same sequence or not e.g. "Groovy".equals("Groovy") will be true if you compare them using equals() method. You can also use equalsIgnoreCase() to check if they are equal irrespective of case e.g. "Apple" and "apple" will be same if you compare them using equalsIgnoreCase() method.

5 Free Ruby and Rails Courses to Learn Online

Hello guys, welcome to this post, here you will find some of the best free courses to learn Ruby programming language and Ruby on Rails framework online. If you don't know what is Ruby and what is Rails framework then let me tell you that its one of the simplest programming language with little to no syntax. If you are new to programming or never coded before then also developing a Ruby application will be much easier than choosing any other programming language like Python or Java. When it comes to developing web development, the Ruby on Rails also makes your job easy by making several useful assumptions based upon convention, which means you can do more by writing less code.

5 Free Object-Oriented Programming Online Courses for Programmers

The OOP or Object Oriented Programming is a paradigm which allows you to write a program by modeling real-world things in terms of class and object. It not only make to represent a real-world thing in programming world easier but also allow you to manage the complexity of your program. Even though there are several programming paradigms e.g. procedural and functional, most of the code we write today is object-oriented and some of the most of popular programming languages are object-oriented e.g. Java, Python, PHP, and JavaScript all supported object-oriented programming.

3 Examples to Generate Random Integers on a Range in Java

Manytimes you need to generate random numbers, particular integers in a range but unfortunately, JDK doesn't provide a simple method like nextIntegerBetween(int minInclusive, int maxExclusive), because of that many Java progarmmers, particularly beginners struggle to generate random numbers between a range e.g. random integers between 1 to 6 if you are creating a game of dice, or random number between 1 to 52 if you are creating a game of playing cards and you need to choose a random card, or most commonly random numbers between 1 to 10 and 1 to 100. Then, the question comes, how to solve this problem? How to generate random int values between a range? Well, you need to do a little bit of work.

Top 5 Free R Programming Courses for Data Scientists and ML Programmers

More and more people are learning R programming language to become a Data Scientist, one of the hottest and high paying technical jobs on the planet. Though, I am from Python camp when it comes on choosing between Python and R for Data Science, Machine Learning, and Artificial Intelligence, mainly because of the awesome libraries Python offers, I had tried R for a short time. If you are also on the same boat and want to try or learn R programming for Data Science and machine learning purpose and looking for some awesome free courses to start your journey then you can take some ideas from this article.

5 Free React Courses for JavaScript Web Developers to Learn Online

React JS is one of the most popular frameworks or Javascript library for building user interfaces. It's backed by Facebook and it's often viewed as an alternative to the Angular framework by Google. React is also very flexible, fast, easy to learn and fun to work with. It is designed to make the process of building modular, reusable user interface components simple and intuitive and that's why most of the modern GUI and web applications are build using React framework. It is developed at Facebook and focuses on the 'View' aspect of MVC in web applications. React was built for the purpose of developing applications that are large in nature and have to deal with time changing data.  So if you need fast refresh i.e. updating individual component without updating whole DOM then React is the right framework.

Java CountDownLatch Example - Multithreading and Concurrency Tutorial

The CountDownLatch is an important concurrency utility class which was added in JDK 1.5 but unfortunately, many Java developers still struggle to understand and use this powerful tool. You can use CountDownLatch if you are spawning multiple threads to do different jobs and want to know when exactly all tasks are finished so that you can move to next stage. In other words, you can block a thread until other threads complete their task. One of the good examples where you can use CountDownLatch is an application which downloads data from a database or another application. For example, we are creating a Java program to download all Udemy courses. Since Udemy has thousands of courses, you create different threads to download different categories e.g. technology, development etc.

Top 5 Spring Security Online Training Courses for Java Developers

Security is one of the most important aspects of a modern web application, be it a Java web application, .NET or writing using any other web technology. In Java world, Spring Security rule the security space. It's one of the rare frameworks which provided many security features e.g. authentication, authorization, session management, remember me and several other useful features out-of-the-box. Since there was no competition to Spring security and it does it job very well, it soon becomes the de-facto standard for implementing security in both Java web applications, REST APIs and core Java applications. The rise of Spring framework certainly helps it to cement its place as well.

6 Free Maven and Jenkins Online Courses for Java Developers

Maven and Jenkins are two of the most popular tools in the Java world. Maven helps to organize your project and provide support to build and deploy Java projects while Jenkins can provide continuous integration and delivery by completely automating build and deploy projects. As a Java developer, it's very important that you know both Maven and Jenkins because every other company is using it and not knowing these technologies will only put you behind other candidates if you go for a job. If you have yet to learn Maven and Jenkins then you have come to the right place, In this article, I will tell you 6 free course you can take to learn Maven and Jenkins online, but before that, let's understand what is Maven and Jenkins and what are their purpose.

7 Free Selenium Web Driver Courses with Java and C# to Learn Automation Testing

Testing is an integral part of software development and we have long been relied on manual testing by testers and QA professional to ship quality software and find bugs, but that's not sustainable anymore. There is an increased focus on automation testing nowadays and Selenium is leading the way with its web driver. If you don't know what is a selenium, here is a quick intro. Selenium is a free automation testing tool for web applications. It can work with different web browsers like Chrome, Firefox, Internet Explorer, Opera and simulate human-like behavior. By using Selenium you can programmatically interact with all the different elements in a webpage. You can click on them, input text, extract text and so much more.

Top 5 Free Courses to Learn Web Development in 2018 - Best of Lot

Hello guys, I have been sharing a lot of free online courses and books on various technology and programming language e.g, Python, Java, C++, JavaScript, PHPReact, Angular, Spring in this blog from quite some time and today I have brought some great free courses to learn basics of web development. Web Development is an important skill for programmers in this era of Startups. As a programmer or software developer, you should know how to create a website and how to create a mobile app of your own. Though it's not easy. Coding is like art and many people born with coding sense, I mean they love coding, they love to create stuff e.g. websites, mobile apps, games etc and they love to automate things. They are a very good self-learner and almost learn anything by themselves, but don't get discouraged if you don't have those skills. By perseverance and hard work, you can also learn whatever you want. In the past, I have shared some tips to learn a new technology and books and courses are an integral part of it.

Eclipse IDE - How to Remote Debug a Java Application Running on Linux

The remote debugging of Java program is an ultimate tool in the arsenal of a Java developer, which is often become the last and only tool to investigate a bug on a Java application running on remote host e.g. on Linux server or Windows server. Almost all major Java IDE provides remote debugging e.g. NetBeans, Eclipse, and IntelliJ IDEA, but I mostly use Eclipse for Java coding and so it's my preferred tool to remote debug a Java program. In order to setup remote debugging in Eclipse, you need to do a couple of tasks e.g. you need to start your JVM with debugging parameters or arguments and then you need to create a "remote debug configuration" in Eclipse IDE itself.

5 Free Linux Courses for Programmers and IT Professionals to Learn Online

Linux is one of the most popular operating systems to run server-side applications. I have seen almost all Java applications running on Linux barring a couple of them which runs on Windows as service. If you take out standalone apps like IDEs or tools, most of the real world Java applications run on Linux e.g. payment gateways, trading systems, and other financial applications. That's why it's very important for any programmer, IT professional, or a developer to learn and understand Linux, both operating system, as well as command line.

5 Free Python Courses for Beginners to Learn Online

Hello guys, If you are a beginner looking for some Free Python resources to start your programming journey then you have come to the right place. Earlier, I have shared a couple of free Python Programming eBooks sand today I'll share a couple of good Python programming courses which are absolutely FREE!! You can take these online courses to learn Python at your own pace, at your own time, and at your place. This is a great advantage of online learning, the flexibility it provides is just awesome.  You just need a laptop or a smartphone with an internet connection and you can learn anything. Btw, before to start with the list of courses to learn Python programming I want to congratulate you for making the right decision to start your programming journey with Python.

Top 5 Free Core Spring, Spring MVC, and Spring Boot Courses for Beginners to learn Online

I have been sharing a lot of resources e.g. books and courses recently and when I published my list of Top 5 courses to learn Spring and Hibernate, many of my readers asked about a similar list of free courses to learn Spring Framework e.g. Core Spring, Spring MVC, Spring Security, and Spring Boot. That request was always back of my mind but I couldn't get time to put together a list, which I can share with you guys, but today is the day. In this list, I have compiled some of the best online free courses to learn Spring Framework from scratch, online at your own pace. You can not only learn core Spring e.g. a framework which provides dependency injection, but also Spring MVC, the most important framework for a Java Web Developer, Spring Security, and Spring Boot to take your career to next level.