What are final classes in Java?

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

11K+ Views

The final modifier for finalizing the implementations of classes, methods, and variables. The main purpose of using a class being declared as final is to prevent the class from being subclassed. If a class is marked as final then no class can inherit any feature from the final class. You cannot extend a final class. If you try it gives you a compile time error. Example final class Super { private int data = 30; } public class Sub extends Super{ public static void main(String args[]){ } } Output ... Read More

Edit report generated from SAP Crystal Reports

Sai Subramanyam
Updated on 30-Jul-2019 22:30:20

415 Views

It does not seem to be feasible to edit the report once generated. You cannot add a constraint or logic to allow your report to be editable.But there does exist a work around, what you can do is: First export the report and then you can change the mode of the document toRestrict Change or Editing. You can write custom code to perform this operation.

What is meant by Java being ‘write once run anywhere’ language?

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

393 Views

Unlike many other programming languages including C and C++, when Java is compiled, it is not compiled into platform specific machine, rather into platform independent byte code. This byte code is distributed over the web and interpreted by the Virtual Machine (JVM) on whichever platform it is being run on. Thus when you write a piece of Java code in a particular platform and generated an executable code .class file. You can execute/run this class file on any system the only condition is that the target system should have JVM (JRE) installed in it. In Short, If you have a ... Read More

When to use vararg methods in Java?

Sai Subramanyam
Updated on 30-Jul-2019 22:30:20

212 Views

Whenever, you want to pass different number of arguments each time you call a method you should use vararg methods. This example creates sumvarargs() method which takes variable no of int numbers as an argument and returns the sum of these arguments as an output. Example Live Demo public class Main { static int sumvarargs(int... intArrays) { int sum, i; sum = 0; for(i = 0; i< intArrays.length; i++) { ... Read More

Is it necessary that a try block should be followed by a catch block in Java?

Samual Sam
Updated on 30-Jul-2019 22:30:20

663 Views

Not necessarily catch, a try must be followed by either catch or finally block. Example import java.io.File; public class Test{ public static void main(String args[]){ System.out.println("Hello"); try{ File file = new File("data"); } } } Output C:\Sample>Javac Test.java Test.java:5: error: 'try' without 'catch', 'finally' or resource declarations try{ ^ 1 error

What are checked exceptions in Java?

Swarali Sree
Updated on 30-Jul-2019 22:30:20

908 Views

A checked exception is an exception that occurs at the time of compilation, these are also called as compile time exceptions. These exceptions cannot simply be ignored at the time of compilation; the programmer should take care of (handle) these exceptions. if you use FileReader class in your program to read data from a file, if the file specified in its constructor doesn't exist, then a FileNotFoundException occurs, and the compiler prompts the programmer to handle the exception. Example import java.io.File; import java.io.FileReader; public class FilenotFound_Demo { public static void main(String args[]) { ... Read More

RFC or BAPI for displaying change documents in SAP

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

542 Views

You need to set up a workflow engine and then customize event generation. Next is to write down a Java service to connect to SAP system using Java Connector and then register a RFC server. For this, you have to follow steps:Navigate to Transaction SM59 -> Expand TCP/IP connections directory and click on Create (F8).In the RFC destination field, enter the name of the RFC destination system. Next is to set the connection type to T (Start an external program through TCP/IP).Next is to provide a Function Module handler that can be called using tRFC from SAP system -> Next ... Read More

How to pass import parameter values using SAP RFC class?

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

526 Views

Check the below link to know detail about SAPRFC class. https://github.com/sensational/php-saprfc/tree/php7https://github.com/piersharding/php-sapnwrfc

What is a JAR file?

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

3K+ Views

A java archive file is a file format/ archiving tool which contains all the components of an executable Java application. All the predefined libraries are available in this format. To include any of these (other than rt.jar) in to your project you need to set the class path for this particular JAR file. You can create a JAR file using the command line options or using any IDE’s. Creating a Jar file You can create a Jar file using the jar command as shown below. jar cf jar-file input-file(s) Let us consider an example, create a Sample Java ... Read More

What are native methods in Java and where are they used?

Samual Sam
Updated on 30-Jul-2019 22:30:20

2K+ Views

A native method in Java is a method whose implementation is written in other languages such as c and c++. The ‘native’ keyword is used before a method to indicate that it is implemented in other language.

Advertisements