seetha

seetha

54 Articles Published

Articles by seetha

54 articles

How do I determine the size of my array in C#

seetha
seetha
Updated on 11-Mar-2026 240 Views

Firstly, set an array −int[] arr = {6, 3, 8, 4};Now, use the Length property to get the size of the array −arr.LengthLet us see the complete code −Exampleusing System; namespace Demo {    public class Demo {       public static void Main(string[] args) {          int[] arr = {6, 3, 8, 4};          Console.WriteLine("Array...");          foreach (int i in arr) {             Console.Write(i + " ");          }          Console.WriteLine("Size of Array: "+arr.Length);       }    } }OutputArray... 6 3 8 4 Size of Array: 4

Read More

Print first letter of each word in a string using C# regex

seetha
seetha
Updated on 11-Mar-2026 517 Views

Let’s say our string is −string str = "The Shape of Water got an Oscar Award!";Use the following Regular Expression to display first letter of each word −@"\b[a-zA-Z]"Here is the complete code −Exampleusing System; using System.Text.RegularExpressions; namespace RegExApplication {    public class Program {       private static void showMatch(string text, string expr) {          Console.WriteLine("The Expression: " + expr);          MatchCollection mc = Regex.Matches(text, expr);          foreach (Match m in mc) {             Console.WriteLine(m);          }       }   ...

Read More

String Formatting in C# to add padding

seetha
seetha
Updated on 11-Mar-2026 1K+ Views

With C#, you can easily format content and add padding to it.To add padding −const string format = "{0,-5} {1,5}";Now, add the padding to the strings −string str1 = string.Format(format, "Rank","Student"); string str2 = string.Format(format, "2","Tom");Let us see the complete code −Exampleusing System; using System.Collections.Generic; public class Program {    public static void Main() {       // set padding       const string format = "{0,-5} {1,5}";       string str1 = string.Format(format, "Rank","Student");       string str2 = string.Format(format, "2","Tom");       Console.WriteLine(str1);       Console.WriteLine(str2);    } }OutputRank Student 2 Tom

Read More

What is the class "class" in Java?

seetha
seetha
Updated on 11-Mar-2026 600 Views

The Java.lang.Class class instance represent classes and interfaces in a running Java application. It has no public constructor. Example Following is the example demonstrates the usage of the class Class. The java.lang.Class.getCanonicalName() method returns the canonical name of the underlying class as defined by the Java Language Specification. It returns null if the class does not have a canonical name. import java.lang.*; public class ClassDemo { public static void main(String[] args) { ClassDemo c = new ClassDemo(); Class cls = c.getClass(); ...

Read More

Set the width of the left border using CSS

seetha
seetha
Updated on 11-Mar-2026 74 Views

To set the width of the left border, use the border-left-width property in CSS. You can try to run the following code to implement the border-left-width property −Example                    p {             border-style: dashed;             border-left-width: 10px;          }                     This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo ...

Read More

Role of CSS :enabled Selector

seetha
seetha
Updated on 11-Mar-2026 252 Views

Use the CSS :enabled selector to style every enabled element. You can try to run the following code to implement the :enabled selector −Example                    input:enabled {             background: blue;          }                              Subject          Student:          Age:          

Read More

Style <input> elements with a value outside a specified range with CSS

seetha
seetha
Updated on 11-Mar-2026 210 Views

Use the CSS :out-of-range selector to style elements with a value outside a specified range.ExampleYou can try to run the following code to implement the :out-of-range selector:                    input:out-of-range {             border: 3px dashed orange;             background: yellow;          }                           The style only works for the value entered out of range    

Read More

What is the keyword used in instantiating a class in Java?

seetha
seetha
Updated on 11-Mar-2026 1K+ Views

An object is created from a class. In Java, the new keyword is used to create new objects. There are three steps when creating an object from a class − Declaration − A variable declaration with a variable name with an object type. Instantiation − The 'new' keyword is used to create the object. Initialization − The 'new' keyword is followed by a call to a constructor. This call initializes the new object. Following is an example of creating an object − Example public class Puppy { public Puppy(String name) { ...

Read More

What are Floating List Items in CSS

seetha
seetha
Updated on 11-Mar-2026 658 Views

To create a horizontal navigation bar, use the floating list item.ExampleYou can try to run the following code to create horizontal navigation bar −                    ul {             list-style-type: none;             margin: 0;             padding: 0;          }          li {             float: left;          }          li a {             display: block;             padding: 8px;             background-color: orange;          }                              Home          News          Contact          About          

Read More

What are valid identifiers in Java?

seetha
seetha
Updated on 11-Mar-2026 885 Views

A valid identifier in java – Must begin with a letter (A to Z or a to z), currency character ($) or an underscore (_). Can have any combination of characters after the first character. Cannot be a keyword. Example Following example shows various possible identifiers used to declare a variable in Java. public class VariableTest { public static void main(String args[]) { // Declaring a variable named num int num = 1; int _num = ...

Read More
Showing 1–10 of 54 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements