Kumar Varma has Published 107 Articles

Java labelled statement

Kumar Varma

Kumar Varma

Updated on 15-Jun-2020 09:06:36

4K+ Views

Yes. Java supports labeled statements. You can put a label before a for statement and use the break/continue controls to jump to that label. ExampleSee the example below.Live Demopublic class Tester {    public static void main(String args[]) {       first:          for (int i ... Read More

Connecting to SAP HANA using odbc_connect() on PHP

Kumar Varma

Kumar Varma

Updated on 12-Jun-2020 12:30:18

733 Views

The error you are getting is because there is no ODBC drivers installed for your PHP client. You would require downloading the drivers from any site on the internet. Following steps can be performed to download the drivers: Download the drivers from https://www.easysoft.com/cgi-bin/account/login.cgi after registration or alternatively check the ODBC-ODBC Bridge Client ... Read More

Find the 3rd smallest number in a Java array.

Kumar Varma

Kumar Varma

Updated on 12-Mar-2020 10:10:40

5K+ Views

ExampleFollowing is the required program.Live Demopublic class Tester {    public static int getThirdSmallest(int[] a) {       int temp;       //sort the array       for (int i = 0; i < a.length; i++) {          for (int j = i + ... Read More

How do I compare strings in Java?

Kumar Varma

Kumar Varma

Updated on 26-Feb-2020 07:09:39

762 Views

You can compare two Strings in Java using the compareTo() method, equals() method or == operator.The compareTo() method compares two strings. The comparison is based on the Unicode value of each character in the strings. The character sequence represented by this String object is compared lexicographically to the character sequence ... Read More

Java String Comparison Methods.

Kumar Varma

Kumar Varma

Updated on 26-Feb-2020 06:49:35

589 Views

Java String class provides different comparison methods namely:The compareTo() methodThis method compares two Strings lexicographically. This method returns  a negative integer if current String object lexicographically precedes the argument string.  a positive integer if current String object lexicographically follows the argument  true when the strings are equal.Exampleimport ... Read More

How to create a subarray from another array in Java

Kumar Varma

Kumar Varma

Updated on 24-Feb-2020 10:42:51

18K+ Views

Use Arrays.copyOfRange() method to get a subarray.Exampleimport java.util.Arrays; public class Tester {    public static void main(String[] args) {       int[] array = new int[] {1, 2, 3, 4, 5};       int[] subArray = Arrays.copyOfRange(array, 0, 2);       System.out.println("Array: ");       for(int ... Read More

Member variables in Java

Kumar Varma

Kumar Varma

Updated on 24-Feb-2020 05:06:13

11K+ Views

Member variables are known as instance variables in java.Instance variables are declared in a class, but outside a method, constructor or any block.When space is allocated for an object in the heap, a slot for each instance variable value is created.Instance variables are created when an object is created with ... Read More

Replacing multiple occurrence by a single occurrence in SAP HANA

Kumar Varma

Kumar Varma

Updated on 14-Feb-2020 05:37:57

940 Views

The code you are using \1+ just removes consecutive occurrences only. You can use the below code.SELECT REPLACE_REGEXPR('(.)(?=.*\1)' IN '22331122' WITH '' OCCURRENCE ALL) FROM DUMMYThe output will come out to be “312”. This will remove all multiple occurrences and only last one will be kept.

How to define an enumerated type (enum) in C++?

Kumar Varma

Kumar Varma

Updated on 11-Feb-2020 07:47:54

370 Views

An enumerated type declares an optional type name and a set of zero or more identifiers that can be used as values of the type. Each enumerator is a constant whose type is the enumeration. For example, if you are creating an application that has a fixed number of types ... Read More

Basics of C++ Programming Language?

Kumar Varma

Kumar Varma

Updated on 11-Feb-2020 05:19:52

703 Views

C++ is a programming language developed by Bjarne Stroustrup in 1979 at Bell Labs. C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features. It is a superset of C, and that virtually any legal C program is a legal C++ ... Read More

Previous 1 ... 3 4 5 6 7 ... 11 Next
Advertisements