Programming Articles

Page 2540 of 2546

How to use Python modules over Paramiko (SSH)?

Rajendra Dharmkar
Rajendra Dharmkar
Updated on 30-Jul-2019 659 Views

You connect and use a python module on the remote computer over SSH, as SSH only provides limited functionality so calling the module isn't possible.You can call a script on the remote server and run that as a way of getting around this problem. To get a result from the script, you can look at it by reading the lines from stdout if you're logging your result. Alternatively, you can write the result to a file and then read the file once the result has been generated and written to the file.If you want to do this over the network ...

Read More

What is the difference between compositions and aggregations in Java?

Sharon Christine
Sharon Christine
Updated on 30-Jul-2019 290 Views

In Aggregation relationship among classes by which a class (object) can be made up of any combination of objects of other classes. It allows objects to be placed directly within the body of other classes.A composition is also a type of aggregation where the relationship is restrictive i.e. If two objects are in composition, the composed object will not exist without the other.

Read More

Difference between Java SE, Java EE, and Java ME?

mkotla
mkotla
Updated on 30-Jul-2019 2K+ Views

Java provides three editions JSE, JEE, JME. JSE − Java Standard Edition using this, you can develop stand-alone applications. This provides the following packages − java.lang − This package provides the language basics. java.util − This package provides classes and interfaces (API’s) related to collection framework, events, data structure and other utility classes such as date. java.io − This package provides classes and interfaces for file operations, and other input and output operations. java.math − This package provides classes and interfaces for multiprecision arithmetics. java.nio − This package provides classes and interfaces the Non-blocking I/O framework for Java java.net ...

Read More

What is meant by Java being platform-independent?

vanithasree
vanithasree
Updated on 30-Jul-2019 450 Views

When you compile Java programs using javac compiler it generates bytecode. We need to execute this bytecode using JVM (Java Virtual machine) Then, JVM translates the Java bytecode to machine understandable code.You can download JVM’s (comes along with JDK or JRE) suitable to your operating system and, once you write a Java program you can run it on any system using JVM.

Read More

What is the difference between compile time errors and run time errors in Java?

Sai Subramanyam
Sai Subramanyam
Updated on 30-Jul-2019 614 Views

Compile time errors are syntactical errors in the code which hinders it from being compiled. Example public class Test{ public static void main(String args[]){ System.out.println("Hello") } } Output C:\Sample>Javac Test.java Test.java:3: error: ';' expected System.out.println("Hello") An exception (or exceptional event) is a problem that arises during the execution of a program. When an Exception occurs the normal flow of the program is disrupted and the program/Application terminates abnormally, which is not recommended, therefore, these exceptions are to be handled. Example ...

Read More

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

seetha
seetha
Updated on 30-Jul-2019 451 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

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

Samual Sam
Samual Sam
Updated on 30-Jul-2019 728 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

Read More

What are checked exceptions in Java?

Swarali Sree
Swarali Sree
Updated on 30-Jul-2019 991 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

What is a JAR file?

varun
varun
Updated on 30-Jul-2019 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
Samual Sam
Updated on 30-Jul-2019 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.

Read More
Showing 25391–25400 of 25,451 articles
Advertisements