Posts

How to generate qr code or barcode in java

Image
In this tutorial, I'll show you how to create a QR code or barcode. How can you utilize or save the generated file?  In this tutorial, we will generate barcodes or QR codes using the zxing java package. zxing is an open-source, multi-format 1D/2D barcode image processing toolkit written in Java with portability to other programming languages. So, first and foremost, make a maven or Gradle project and follow this. Add these dependencies to your project. Maven Gradle <dependency> <groupId>com.google.zxing</groupId> <artifactId>core</artifactId> <version>3.4.1</version> </dependency> <dependency> <groupId>com.google.zxing</groupId> <artifactId>javase</artifactId> <version>3.4.1</version> </dependency> implementation 'com.google.zxing:core:3.4.1' implementation 'com.google.zxing:javase:3...

What is difference between length and length() in java

Image
T his is also a confusing topic of java and most beginners get confused about length and length(). I was also confused about this topic. After reading this article you will never get confused. So, We know that java is an Object Oriented Programming language we denote class as a template of objects and method is an action that an object is able to perform. You will see in java docs if we access any member of some class we use a method rather than a variable. Likewise,  length():- length() is a function of string class that is used to get the length of a string. And length:- length is variable for getting the length of an array. Look At the example:- Length() with string FindLength.java public class FindLength { public static void main(String[] args) { String str = "this is skx coding"; int strLength = str.length(); System.out.println("length of str: "+ strLen...

Everything you need to know about finding index of item in list with java

Image
In this article, we will discuss finding the index of the list. List<T> is an interface in java that provides many helpful methods for operating items of lists. The IndexOf() method returns the index of an item if the item found else it return -1. There are two methods we can use for finding index: indexOf(Object obj):- This method returns the first index of an item if it is present in the list. FindIndex.java import java.util.Arrays; import java.util.List; public class FindIndex { public static void main(String[] args) { List<String> list = Arrays.asList( "Are", "you", "programmer","?", "you", "are", "awesome!." ); String findMe = "you"; System.out.println("Index of "+ findMe +": " +list.lastIndexOf(findMe)); } } Ou...

java project swing analog clock program

This Analog Clock project is a swing java project. What should you know before start? what is java? what is javax.swing package swing GUI metaphors Q. what is java? A. Java is an object-oriented general-purpose programming language. It is intended to let application developers write once and run anywhere. Java is one of the most popular programming languages in use according to GitHub, particularly for client-server web applications. Java is designed by James Gosling and developed by Sun Microsystem. Q. What is swing? A. Swing is used to create window-based applications. It is built on the top of AWT (Abstract Windowing Toolkit) API and entirely written in java. Unlike AWT, Java Swing provides platform-independent and lightweight components. The javax.swing package provides classes for java swing API such as JButton, JTextField, JTextArea, JRadioButt...

String Programming set on java, kotlin, python, c and c++

Hey there! Here, you would find practice sets for string input output questions and their solutions that are solved in 5 different programming languages c , c++ , java , kotlin, and python . All programs have been tested. Program develop tools VS code - text editor Linux - operating system java 11 kotlin 1.7.32 python 3.7 g++ for c and c++ you can find all code at github click here What should you know before start what is string if else statement for each loop for java loop, nested loop 1 Input your name and print on console. Solution input : Enter your name: sagar output : ...

String input in c (with example)

A string is an array of characters in c, the string is written under the double quotes only. Even though any numeric or single alphabetical character written under the double quotes, all are considered as a string. Example: char str[] = "programz1000" These are three methods for getting input from the user:- scanf() -> We can input string by two ways with scanf() method: Syntex: scanf("%s",string) Example: #include<stdio.h> int main(){ char str[20]; scanf("%s",str); printf("%s",str); return 0; } Input: Programz rocks Output: Porgramz Note: In this program, It doesn't accept string after first space ...

Pattern Programming in c c++ java kotlin and python

Pattern Programming Here, you would find practice sets for some basic questions and there solutions that are solved in 5 different programming languages c , c++ , java , kotlin and python . All programs have been tested. Program develop tools VS code - text editor Linux - operating system java 11 kotlin CLI python 3.7 g++ for c and c++ Practicle 1 Pattern program 1 Solution output : * ** *** **** ***** c c++ Java Kotlin Python ...