Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Programming Articles
Page 24 of 2546
Java Program to pass method call as arguments to another method
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 MoreCheck if a binary string contains all permutations of length k in C++
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 MoreString Concatenation by concat() method.
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 MoreHow to find a matching substring using regular expression in C#?
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 MoreJava Program to Print Pyramid Star Pattern
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 MoreHow to find the vowels in a given string using Java?
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 MoreHow to get the POST values from serializeArray in PHP?
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 MoreHow to find consonants in a given string using Java?
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 MoreHow to extract the first n characters from a string using Java?
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 MoreHow to extract the last n characters from a string using Java?
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