Programming Articles

Page 24 of 2546

Java Program to pass method call as arguments to another method

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 22K+ Views

In this article, we will understand how to pass method call as arguments to another method. We can call a method from another class by just creating an object of that class inside another class. After creating an object, call methods using the object reference variable.Below is a demonstration of the same −InputSuppose our input is −Enter two numbers : 2 and 3OutputThe desired output would be −The cube of the sum of two numbers is: 125AlgorithmStep 1 - START Step 2 - Declare two variables values namely my_input_1 and my_input_2 Step 3 - We define a function that takes ...

Read More

Check if a binary string contains all permutations of length k in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 191 Views

Suppose we have a binary string, another integer k. We have to check the string is containing all permutations of binary of k bits. Suppose a string is like “11001”, and if the K = 2, then it must have all permutations of k bit numbers. (00, 01, 10, 11), the given string has all permutation. So this is valid string.by taking the binary string and the value of k, we have to check whether binary sequences are matched or not. The binary sequence is made of size k. So there will be 2k number of different binary permutations. We ...

Read More

String Concatenation by concat() method.

Alankritha Ammu
Alankritha Ammu
Updated on 11-Mar-2026 270 Views

You can concatenate two strings using the concat() method of the String class. This class concatenates the specified string to the end of this string.Examplepublic class Test {    public static void main(String args[]){       String str1 = "Krishna";       String str2 = "Kasyap";       System.out.println(str1.concat(str2));    } }OutputkrishnaKasyap

Read More

How to find a matching substring using regular expression in C#?

Samual Sam
Samual Sam
Updated on 11-Mar-2026 2K+ Views

Our string is − string str = " My make "; Use the following regular expression to find the substring “make” @"\bmake\b" Here is the complete code − Example using 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); ...

Read More

Java Program to Print Pyramid Star Pattern

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 812 Views

In this article, we will understand how to print pyramid star pattern. The pattern is formed by using multiple for-loops and print statements. Below is a demonstration of the same − Input Suppose our input is − Enter the number of rows : 8 Output The desired output would be − The pyramid star pattern : * * * * * * * * * * * * * * * * ...

Read More

How to find the vowels in a given string using Java?

Arushi
Arushi
Updated on 11-Mar-2026 39K+ Views

You can read a character in a String using the charAt() method. To find the vowels in a given String you need to compare every character in it with the vowel letters. Example public class FindingVowels {    public static void main(String args[]) {       String str = new String("Hi Welcome to Tutorialspoint");       for(int i=0; i

Read More

How to get the POST values from serializeArray in PHP?

Ricky Barnes
Ricky Barnes
Updated on 11-Mar-2026 3K+ Views

To get the POST values from serializeArray in PHP, use the serializeArray() method. The serializeArray( ) method serializes all forms and form elements like the .serialize() method but returns a JSON data structure for you to work with.Let’s say we have the PHP content in serialize.php file:ExampleThe following is an example showing the usage of this method:           The jQuery Example                              $(document).ready(function() {                         $("#driver").click(function(event){       ...

Read More

How to find consonants in a given string using Java?

George John
George John
Updated on 11-Mar-2026 4K+ Views

One way to find the vowels in a given String is to compare every character in it using the charAt() method with the vowel letters. Example public class FindingConsonants { public static void main(String args[]) { String str = new String("Hi Welcome to Tutorialspoint"); for(int i=0; i

Read More

How to extract the first n characters from a string using Java?

Rishi Raj
Rishi Raj
Updated on 11-Mar-2026 945 Views

To find the consonants in the given String compare every character in it using the charAt() method with the vowel letters and remaining are consonants.Examplepublic class FindingConsonants {    public static void main(String args[]) {       String str = new String("Hi Welcome to Tutorialspoint");       for(int i=0; i

Read More

How to extract the last n characters from a string using Java?

Vikyath Ram
Vikyath Ram
Updated on 11-Mar-2026 12K+ Views

To extract last n characters, simply print (length-n)th character to nth character using the charAt() method.Examplepublic class ExtractingCharactersFromStrings {    public static void main(String args[]) {           String str = "Hi welcome to tutorialspoint";       int n = 5;       int initial = str.length()-5;       for(int i=initial; i

Read More
Showing 231–240 of 25,451 articles
« Prev 1 22 23 24 25 26 2546 Next »
Advertisements