• 07 April

    TypeError: String Indices Must be Integers

    In this post, we will see about TypeError: String Indices Must be Integers in Python. You can access the characters of string by its index. Each index specifies the position for the character. For example: Let’s say you want to print 3rd element of the String 'Java2blog', you can use str1[2]. [crayon-678940b1554cd712209185/] Output: v If […]

  • 05 April

    Local variable referenced before assignment

    In this post, we will see about error Local variable referenced before assignment in Python. Problem Let me explain this error with the help of an example. [crayon-678940b15578b079157909/] When you run above program, you will get below output: [crayon-678940b15578f913071698/] Let’s understand why we are getting this error UnboundLocalError. When Python interpreter parses any function definition […]

  • 04 April

    SyntaxError: ‘Return’ Outside Function

    In this post, we will see about SyntaxError: 'Return' Outside Function in Python. This error will generally occur when you do not put the return statement indentation properly with function definition. 💡 Did you know? Unlike C,C++ or java, Python uses whitespace for indentation. All statements which are at same distance on right belong to […]

  • 01 April

    SyntaxError: eol while scanning string literal

    In this post, we will see about SyntaxError eol while scanning string literal. SyntaxError are raised when python interpreter is translating source code in bytes and it generally means there is something wrong with the syntax. These errors are also easy to figure out and fix as well. You will get SyntaxError eol while scanning […]

  • 29 March

    Read UTF-8 Encoded Data in java

    In this post, we will see how to read UTF-8 Encoded Data. Sometimes, we have to deal with UTF-8 Encoded Data in our application. It may be due localization or may be processing data from user input. There are multiple ways to read UTF-8 Encoded Data in Java. Using Files’s newBufferedReader() We can use java.nio.file.Files's […]

  • 29 March

    Write UTF-8 Encoded Data in java

    In this post, we will see how to write UTF-8 Encoded Data. Sometimes, we have to deal with UTF-8 Encoded Data in our application. It may be due localization or may be processing data from user input. We will use Hindi language sentences to write in file. There are three ways to write UTF-8 Encoded […]

  • 29 March

    Modulo operator in java

    In this post, we will see about modulo or modulus operator in java. Modulo operator(%) is used to find the remainder when one integer is divided by another integer. Modulo operator Syntax [crayon-678940b155da3148329197/] We can’t use modulo with any other data type other than int. If we use it with other data types, it will […]

  • 28 March

    Generate source code jar for Maven based project

    In this tutorial, we will see how to generate source code jar for maven based project. If you have simple java project, then you need to convert it maven project. Sometimes, you need to pack source code with your project jar. This is extremely useful when people use your library and can attach source code […]

  • 27 March

    Understanding java.lang.reflect.InvocationTargetException and why it occurs

    In this post, we will see about java.lang.reflect.InvocationTargetException. You might get java.lang.reflect.InvocationTargetException while working with reflection in java. Reason for java.lang.reflect.InvocationTargetException Reflection layer throws this exception when calling method or constructor throws any exception. java.lang.reflect.InvocationTargetException wraps underlying exception thrown by actual method or constructor call. Let’s see this with the help of example: Create a […]