Karthikeya Boyini has Published 2550 Articles

Java Program to access character of a string

karthikeya Boyini

karthikeya Boyini

Updated on 12-Sep-2023 02:02:27

30K+ Views

To access character of a string in Java, use the charAt() method. The position is to be added as the parameter.Let’s say we have the following string −String str = "laptop";Let’s find the character at the 4th position using charAt() method.str.charAt(3));The following is the final example.Example Live Demopublic class Demo { ... Read More

C# Program to check if a number is prime or not

karthikeya Boyini

karthikeya Boyini

Updated on 10-Sep-2023 08:06:41

37K+ Views

To calculate whether a number is prime or not, we have used a for loop. Within that on every iteration, we use an if statement to find that the remainder is equal to 0, between the number itself.for (int i = 1; i

Java program to find all duplicate characters in a string

karthikeya Boyini

karthikeya Boyini

Updated on 08-Sep-2023 23:18:21

37K+ Views

The duplicate characters in a string are those that occur more than once. These characters can be found using a nested for loop. An example of this is given as follows − String = Apple In the above string, p is a duplicate character as it occurs more than ... Read More

Check whether a character is Uppercase or not in Java

karthikeya Boyini

karthikeya Boyini

Updated on 06-Sep-2023 21:10:01

37K+ Views

To check whether a character is in Uppercase or not in Java, use the Character.isUpperCase() method.We have a character to be checked.char val = 'K';Now let us use the Character.isUpperCase() method.if (Character.isUpperCase(val)) {    System.out.println("Character is in Uppercase!"); }else {    System.out.println("Character is in Lowercase!"); }Let us see the complete ... Read More

How to initialize a list to an empty list in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 06-Sep-2023 20:56:09

39K+ Views

To initialize a list to an empty list in C#, set it like the following statement without any elements −List list = new List();Now, use the Any() method to check whether the list is empty or not −bool chk = !list.Any();Let us see the complete code −Example Live Demousing System; using ... Read More

C# Program to Convert Integer to String

karthikeya Boyini

karthikeya Boyini

Updated on 02-Sep-2023 15:26:43

39K+ Views

To convert an integer to string in C#, use the ToString() method.Set the integer for which you want the string −int num = 299;Use the ToString() method to convert Integer to String −String s; int num = 299; s = num.ToString();ExampleYou can try to run the following code to convert ... Read More

C# int.TryParse Method

karthikeya Boyini

karthikeya Boyini

Updated on 02-Sep-2023 14:17:10

51K+ Views

Convert a string representation of number to an integer, using the int.TryParse() method in C#. If the string cannot be converted, then the int.TryParse() method returns false i.e. a Boolean value.Let’s say you have a string representation of a number.string myStr = "12";Now to convert it to an integer, use ... Read More

Float and Double in C

karthikeya Boyini

karthikeya Boyini

Updated on 02-Sep-2023 14:14:10

50K+ Views

FloatFloat is a datatype which is used to represent the floating point numbers. It is a 32-bit IEEE 754 single precision floating point number (1-bit for the sign, 8-bit for exponent, 23*-bit for the value. It has 6 decimal digits of precision.Here is the syntax of float in C language, ... Read More

Get the size of an ArrayList in Java

karthikeya Boyini

karthikeya Boyini

Updated on 02-Sep-2023 11:58:40

51K+ Views

The size of an ArrayList can be obtained by using the java.util.ArrayList.size() method as it returns the number of elements in the ArrayList i.e. the size.A program that demonstrates this is given as follows −Example Live Demoimport java.util.ArrayList; import java.util.List; public class Demo { public static void main(String[] ... Read More

Turtle programming in Python

karthikeya Boyini

karthikeya Boyini

Updated on 27-Aug-2023 03:38:10

35K+ Views

Turtle is a special feature of Python. Using Turtle, we can easily draw in a drawing board.First, we import the turtle module. Then create a window, we create a turtle object, and using the turtle() method we can draw on the drawing board. Some turtle method METHOD PARAMETER ... Read More

Advertisements