Skip to main content

Q) What are the features of java makes it distinct from other conventional programming language ? How is it possible ? What is its benefit ?



A)

1) Java applications are platform independent (architectural neutral).
2) That means, if we develop and compile a java application in one operating system (os) environment, the resultant file (class file) can be executed in any other os environment. This is nothing but platform independency.
“Operating system + hardware (processor) = platform
Java programs os independent.
Os is considered as “real machines”.
Ex: windows machine, linux machine, mac machine.
Same source code compiles & run at any environment with zero modifications or less modifications that is called portability.
Ex: java programs.
After compile over the resultant file run at any other environment. That is called platform independent.
Ex: java
The c and c++ programs in which os the file is compiled that exe file is understand by that processor only not understand by other processor. That’s why they are not platform independent. So, the c and c++ are not portable.
Java programs don’t run directly on os. Therefore java  applications are os independent.

Two things contribute to the os independency of java applications.
    1)      Class file
    2)    os dependent JVM(java virtual machine)
If we compile java programs in any os that produce same class file.
If we compile a java application in any os environment we get same class file(s).
When compile c or c++ that produce exe file that contain instructions to that particular os only. So that is os dependent.
A class file contains byte code. Byte code contains instructions understandable to any kind of JVM.JVMs are many kinds.
JVMs are os dependent.
JVM :
        JVM is a special software that provides execution environment for java programs main goal of JVM is to execute java applications.

        JVMs are os dependent.
            Ex : JVM for windows different.
                    JVM for unix different.
JVM converts byte code into underlying os understandable machine instructions to be given to the process. JVM is a translator.
For java programs real machine is not provide execution environment.  The JVM only provide the execution environment for conventional program.
If an application is os independent developers need not be thinking about os specific functionality and as all the users can use it. More market and hence at cheaper price software can be produced.

Comments

Popular posts from this blog

Q) Explain repeated deletion of records.

A) //RepeatedDeletion.java import java.util.Scanner; import java.sql.*; class RepeatedDeletion {        public static void main(String[] args) {               Connection con= DriverManager. getConnection ( "jdbc:odbc:prince" , "scott" , "tiger" );               PreparedStatement ps=con.PreparedStatement( "DELETE FROM ACCOUNT WHERE ACCNO=?" );               Scanner s= new Scanner(System. in );               while ( true )               {                      System. out .println( "Enter accno : " );      ...

Q) Retrieving data from database?

A)   ->to retrieve the data from database we need to submit SELECT statement from JDBC application. -> executeQuery() method of statement object is used for this purpose. This method has the fallowing ResultSet executeQuery(String sql) throws SQLException Ex: ResultSet rs = st.executeQuery(“SELECT * FROM ACCOUNT”); ->objectoriented representation of tables formate data is called ResultSet object. Ao the driver created one object i.e. ResultSet object. ->object orientation representation of a table of records returned from db is nothing but “ ResultSet ” object.  

Q) What is the purpose of JDBC?

A) -> Java application can do any task by making a method (function) call. ->java method calls are not understandable to database management system. They can understand only SQL statements. ->SQL statements can’t be directly used in a java application. Java compiler complains. ->therefore, we say that java environment and database environment are heterogeneous to each other. Purpose of JDBC: ->for any kind of java application to communicate with any kind of database (management system) in a standard manner, JDBC is used.