What is the meaning of immutable in term of String in java?

Arushi
Updated on 30-Jul-2019 22:30:20

280 Views

In Java, immutable objects are those whose data can’t be changed or modified (once modified). String class is immutable i.e. once we create a String object its data cannot be modified.

How many ways a String object can be created in java?

George John
Updated on 30-Jul-2019 22:30:20

1K+ Views

You can create a String by − Step 1 − Assigning a string value wrapped in " " to a String type variable. String message = "Hello Welcome to Tutorialspoint"; Step 2 − Creating an object of the String class using the new keyword by passing the string value as a parameter of its constructor. String message = new String ("Hello Welcome to Tutorialspoint"); Step 3 − Passing a character array to the String constructor. char arr[] = {'H','e','l','l','o'}; String message = new String(arr);

Using JCo to connect SAP with Android

SAP Developer
Updated on 30-Jul-2019 22:30:20

321 Views

I have not tried it but it does not seem feasible. The reason being if you are planning to use JCo library, you will require a native library but that is still not available for Android environment.You can try an alternative for it. You can create a Web Service either a SOAP or REST which communicates to SAP via JCo. Then, you can use the service to do two way communication with SAP.The result of communication can then be shared to Android environment in either JSON or XML format as per requirement.

Reduce number of columns of a result set from a Transaction in SAP system

SAP Developer
Updated on 30-Jul-2019 22:30:20

165 Views

The simple answer to your question is NO. Because, this is SAP standard behavior and if you want to restrict the number of columns to be returned then it will require you to change the original source code of SAP implementation.The change will be quite exhaustive and it will also mean that you are violating the contract and hence, no support from SAP on any issue encountered later.As you said you are filtering data that means the number of rows will not be huge and hence the number of columns will not have much implication on the performance of the ... Read More

What is the difference between a String object and a String literal in Java?

Paul Richard
Updated on 30-Jul-2019 22:30:20

948 Views

When the String literal used to create String, JVM initially checks weather String with the same value in the String constant pool, if available it creates another reference to it else it creates a new object and stores it in the String constant pool.In case of an object, each time you instantiate the class a new object is created given value irrespective of the contents of the String constant pool.

What is the super() construct of a constructor in Java?

Sharon Christine
Updated on 30-Jul-2019 22:30:20

530 Views

The super keyword is similar to this keyword. Following are the scenarios where a super keyword is used. It is used to differentiate the members of superclass from the members of the subclass if they have same names. It is used to invoke the superclass constructor from the subclass. Whenever you want to call the constructor of the superclass from a method or another constructor you can do so as: Example class Person { Person(String name) { System.out.println("Hello "+ name); } } class Student ... Read More

Can interfaces have constructors in Java?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:20

722 Views

No, interfaces can’t have constructors for the following reasons − All the members of an interface are abstract, and since a constructor cannot be abstract. Still, if you try to write a constructor within an interface it will generate a compile time error. Example public interface InterfaceTest { InterfaceTest(){ } public abstract void display(); public abstract void show(); } Error C:\Sample>javac InterfaceTest.java InterfaceTest.java:2: error: expected public InterfaceTest(){ ^ 1 error

What is the difference between a String object and a StringBuffer object in java?

Rishi Raj
Updated on 30-Jul-2019 22:30:20

430 Views

String class is immutable once you create an object of string you can modify its data.The StringBuffer class is immutable, once you create a StringBuffer object you can change/modify the contents of it.This class provides various methods to manipulate its data such as append(), delete(), insert() etc.

Best way to connect to SAP system from JAVA

SAP Developer
Updated on 30-Jul-2019 22:30:20

2K+ Views

There are lots of possibilities but a lot depends upon on your exact requirement and needs.One way is that you can go ahead and use Java Connector also known as JCo. JCo is a prevalent option to do similar requirements as of yours. It has a lot of support available online as well.Also, as you said Web service is by default the web standard and can be opted too. SAP functions are readily available and can be tuned effortlessly to be available as web services.

What is the difference between super and this, keywords in Java?

Lakshmi Srinivas
Updated on 30-Jul-2019 22:30:20

673 Views

The this is a keyword in Java which is used as a reference to the object of the current class. Using it you can − Differentiate the instance variables from local variables if they have same names, within a constructor or a method. Call one type of constructor (parametrized constructor or default) from other in a class. It is known as explicit constructor invocation. Example class Superclass { int age; Superclass(int age) { this.age = age; } public void ... Read More

Advertisements