Wednesday 9 April 2014

Programming & Design

Key contrast:Java is a modifying dialect, which has been affected by the C dialect. It infers much of its linguistic use from C and C++, notwithstanding it has fewer low-level offices than either. Java is a broadly useful modifying dialect that is intended to have fewer usage conditions as contrasted with past dialects. PHP, then again, is a server-side scripting dialect that has its fundamental execution in web improvement. Nonetheless, it could be utilized as a broadly useful modifying dialect.

                                

Java was produced by James Gosling at Sun Microsystems and was discharged in 1995. It was initially discharged as a center segment of Sun Microsystems' Java stage. Sun has since re-authorized the majority of its Java advances under the GNU General Public License. This implies that all the innovation authorized under GNU General Public License is open source and by and large accessible free of expense. Sun Microsystems inevitably united into Oracle Corporation.

java is intended to permit the same code to run on different stages. i.e., engineers are permitted to "compose once, run anyplace" (WORA). Subsequently, Java provisions are normally incorporated to bytecode. A class document which holds a Java bytecode can then be run on any Java Virtual Machine (JVM). This might be paying little mind to machine construction modeling. 

Starting 2012, Java has turned into a standout amongst the most prominent modifying dialects for utilization. This is particularly valid for customer server web requisitions. Numerous different frameworks have created elective executions of Sun innovations, for example, GNU Compiler for Java and GNU Classpath.
                                                                                    

PHP is an open source, server-side, HTML embedded scripting language. It can basically perform any task that other CGI programs can, but it is mainly used to create dynamic Web pages. Its main advantage is that it is compatible with many types of databases. Furthermore, PHP can talk across networks using IMAP, SNMP, NNTP, POP3, or HTTP.

PHP includes a command-line interface capability and can be used in standalone graphical applications. PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. In the HTML document, the PHP script is enclosed within special PHP tags. Due to these tags, the programmer can alternate between HTML and PHP instead of having to rely on heavy amounts of code to output HTML. Also, as PHP is executed on the server, the client cannot view the PHP code.
Some differences between Java and PHP:
  • Every variable in Java needs to be prepended with a data type. This includes primitive types such as boolean, int, double and char, as well as Object data-types, such as ArrayList, String, and own objects.
  • In Java, every variable can only hold a value of its type.
  • In Java, equality on objects checks for object identity.
  • In Java, arrays are the classic C arrays. They can only hold variables of one particular type, and need to be created with a fixed length.
  • Java contains a series of collection Objects, one of which is named ArrayList. ArrayList will act more like PHP arrays.
  • In Java, one cannot get the array like syntax; all manipulation must be done through methods.
  • In Java, ArrayLists and other collections are implemented with generics.
  • Java has no pointers. However, all Objects are actually references, similar to PHP 5, and dissimilar to PHP 4.
  • All method parameters are passed by value in Java.
  • The main code entry point in Java is a method to a class, as opposed to PHP where it is not.
  • In Java, variable names do not usually start with a sigil ($).
  • Class names in Java are case sensitive.
  • Strings are not mutable in Java.
  • The Java Class library provides a mechanism to implement threads. PHP has no such mechanism.
  • PHP methods and functions allow for optional parameters. In Java, a separate method must be defined for each possible list of parameters.
  • PHP requires an explicit $this be used when an object calls its own methods. Java does not.
  • Java programs tend to be built from a "program runs, stays running, processes requests" kind of way, whereas PHP applications are built from a "run, handle the request, stop running" kind of way.
  • Java is compiled to bytecode, PHP is interpreted.
  • Java is strong and statically typed, while PHP is rather weakly and dynamically typed.
  • PHP is mostly used to dynamically generate Webpages. Java can do that too, as well as Applets, mobile phone software, Enterprise stuff, desktop application with and without GUI, 3d games, Google Web Toolkit, etc.
  • PHP offers OOP (object oriented programming) as an option that is ignored in most projects. In, Java, OOP is the default.
  • String constants in PHP are declared using single or double quotes. Double quotes will evaluate variables embedded in the text. All Java String constants use double quotes and have no such variable evaluation.
  • PHP object method calls use the -> operator. Java uses the . operator
  • Constructors in Java are named after the class name. In PHP they are called __construct()
  • Method overriding and overloading is quite natural in Java but a bit of a kludge in PHP
  • PHP code is embedded in what is otherwise largely an HTML document, much like how JSPs work
  • In PHP, there is no method overloading, but methods and functions can have optional parameters                  
                                                  "News powered by"
                                                                            
       
 
Share:

No comments:

Post a Comment

© World Of Programmers All rights reserved | Theme Designed by Seo Blogger Templates