• 26 March

    Global variables in java

    In this post, we will see how to define global variables in java. Unlike C/C++, there are no standard global variables in java but you can still define global variables that can be used across all classes. Global variables are those variables that can be accessed across all the classes. Java does not support global […]

  • 26 March

    [Fixed] no suitable driver found for jdbc

    In this post, we will see how to resolve java.sql.SQLException: No suitable driver found for JDBC. There can be multiple reasons for this exception and let’s see it one by one. connector jar is not on classpath you need make sure you have connector jar on classpath. For example: If you are using mysql to […]

  • 26 March

    Static block in java

    In this post, we will see about how to implement static block in java. Here are some important points about static block in java. Static block is used for static initializations of a class Static block is executed only once when either you create an object of the class or access static member of the […]

  • 26 March

    Java boolean default value

    In this post, we will see what is default value of boolean and Boolean in java. 💡 Did you know? The Default value of boolean is false and wrapper class Boolean is null. Here is the example to demonstrate the same. [crayon-67893952b318b216082598/] Output: Default value of boolean: false Default value of Boolean(Wrapper): null As you […]

  • 26 March

    Find average of list in Python

    There are multiple ways to find the average of the list in Python. Using sum() and len() We can use sum() to find sum of list and then divide it with len() to find average of list in Python. Here is the quick example of the same. [crayon-67893952b3214339858983/] Output: Average of listOfIntegers: 3.0 Using reduce(), […]

  • 26 March

    Python list files in directory

    In this post, we will see how to list all files in a directory in Python. There are multiple ways to list all files in a directory in Python. Using os.walk Python os module provides multiple function to get list of files. List all files in directory and its subdirectories using os.walk(path). It iterates directory […]

  • 24 March

    Initialize List of String in java

    In this post, we will see how to initialize List of String in java. Can you initialize List of String as below: [crayon-67893952b3408156825397/] You can't because List is an interface and it can not be instantiated with new List(). You need to instantiate it with the class that implements the List interface. Here are the […]

  • 23 March

    Python String to bytes

    In this post, we will see how to convert String to bytes in Python. There are two ways to convert String to bytes in Python. Using bytes() constructor You can use bytes() constructor to convert String to bytes in Python. You need to pass string and encoding as argument. Here is an example: [crayon-67893952b352c692691859/] Output: […]

  • 23 March

    Python write to text file

    In this post, we will see how to write to a text file. There are multiple modes in which you can write to text file. Create txt file(‘x’) It will open the file in 'X' mode which will create new file and return error in case file already exists. [crayon-67893952b35bf065973563/] Here is content of fruits.txt. […]