Karthikeya Boyini has Published 2386 Articles

Split String with Comma (,) in Java

karthikeya Boyini

karthikeya Boyini

Updated on 13-Sep-2023 15:45:12

29K+ Views

Let’s say the following is our string.String str = " This is demo text, and demo line!";To split a string with comma, use the split() method in Java.str.split("[, ]", 0);The following is the complete example.Example Live Demopublic class Demo {     public static void main(String[] args) {        String str = "This is demo text, and demo line!";   ... 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

42K+ 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

Check whether a character is Uppercase or not in Java

karthikeya Boyini

karthikeya Boyini

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

39K+ 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

42K+ 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

41K+ 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

55K+ 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

51K+ 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

40K+ 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

Difference between Method and Function in Python

karthikeya Boyini

karthikeya Boyini

Updated on 26-Aug-2023 08:56:37

28K+ Views

FunctionA function is a block of code to carry out a specific task, will contain its own scope and is called by name. All functions may contain zero(no) arguments or more than one arguments. On exit, a function can or can not return one or more values.Basic function syntaxdef functionName( ... Read More

Advertisements