Difference between revisions of "Java (programming language)"
m (adjusted wikilink) |
|||
| (17 intermediate revisions by 13 users not shown) | |||
| Line 1: | Line 1: | ||
[[Image:322px-Java Logo svg.png|right|thumb|100px|Java logo.]] | [[Image:322px-Java Logo svg.png|right|thumb|100px|Java logo.]] | ||
| − | '''Java''' is an [[object-oriented]] [[programming language]] developed by [[Sun Microsystems]] in the | + | '''Java''' (pronounced jaa-vuh) is an [[Object Oriented programming|object-oriented]], high-level [[programming language]] developed by [[Sun Microsystems]] in the 1990s. Its syntax is similar to that of C++, but with some modifications. One of the major features which make Java programs easier to write than C++ programs is its support for automatic [[memory management]]. The best-selling Minecraft game was originally written and improved in the Java programming language.<br /> |
| − | The Java [[compiler]] provided by Sun Microsystems compiles Java code to bytecode, which requires the Java Virtual Machine (commonly referred to as a JVM) to execute. This model was adopted by Microsoft for [[C Sharp | C#]] and other [[.NET]] languages. [[IBM]] and others supply regular Java compilers for those who don't want to use the [[virtual machine]]. | + | Java managed to cover two problems plaguing the C/C++ world: [[complexity]] (C++) and [[memory management]] (C/C++). These two were real problems because projects plagued with bugs created by complexity and with memory leaks.<ref>http://littletutorials.com/2008/05/28/13-reasons-java-die-old-age</ref> |
| + | |||
| + | The Java [[compiler]] provided by Sun Microsystems compiles Java code to bytecode, which requires the Java Virtual Machine (commonly referred to as a JVM) to execute. This model was adopted by Microsoft for [[C Sharp|C#]] and other [[.NET]] languages. [[IBM]] and others supply regular Java compilers for those who don't want to use the [[virtual machine]]. | ||
Java applications are popular in creating [[applets]] for websites, due to their cross-platform nature. It still has not gained widespread popularity in stand-alone Windows applications, but is used primarily on web servers. | Java applications are popular in creating [[applets]] for websites, due to their cross-platform nature. It still has not gained widespread popularity in stand-alone Windows applications, but is used primarily on web servers. | ||
| + | |||
| + | Google's [[Dalvik]], based on Java, is a programming language used on [[Android]]. Oracle (who acquired Sun Microsystems in 2009) has filed a lawsuit alleging that Dalvik infringes Oracle's copyrights and patents on the Java programming language. The lawsuit is currently being tried, as of April 2012. | ||
==Memory Management== | ==Memory Management== | ||
The Java programming language is based on [[Object Oriented programming]] principles, coupled with [[garbage collection]]. This means, unlike [[C]] and other lower level programming languages the developer is able to create programs without worrying about pointers, references and memory. Instead the Java [[Virtual Machine]] is able to manage objects that are in use, periodically deleting objects that are no longer referenced (and therefore no longer required by the program). | The Java programming language is based on [[Object Oriented programming]] principles, coupled with [[garbage collection]]. This means, unlike [[C]] and other lower level programming languages the developer is able to create programs without worrying about pointers, references and memory. Instead the Java [[Virtual Machine]] is able to manage objects that are in use, periodically deleting objects that are no longer referenced (and therefore no longer required by the program). | ||
| − | ==External | + | == Example Code == |
| − | [http://www.java.com/ Official Java Website] | + | === Hello, World === |
| + | An example program often used for languages is something that displays "Hello, World!". | ||
| + | |||
| + | <pre> | ||
| + | public class World { | ||
| + | public static void main(String[] args) { | ||
| + | System.out.println("Hello, World!"); | ||
| + | } | ||
| + | }</pre> | ||
| + | |||
| + | === GUI with JFrame === | ||
| + | An example of creating and showing a JFrame with nothing in it: | ||
| + | <pre>JFrame frame = new JFrame(); | ||
| + | frame.show();</pre> | ||
| + | |||
| + | ==References== | ||
| + | {{reflist}} | ||
| + | |||
| + | ==See also== | ||
| + | *[[Android apps]] | ||
| + | |||
| + | ==External links== | ||
| + | * [http://www.java.com/ Official Java Website] | ||
| + | |||
[[Category:Programming Languages]] | [[Category:Programming Languages]] | ||
Latest revision as of 04:50, May 22, 2023
Java (pronounced jaa-vuh) is an object-oriented, high-level programming language developed by Sun Microsystems in the 1990s. Its syntax is similar to that of C++, but with some modifications. One of the major features which make Java programs easier to write than C++ programs is its support for automatic memory management. The best-selling Minecraft game was originally written and improved in the Java programming language.
Java managed to cover two problems plaguing the C/C++ world: complexity (C++) and memory management (C/C++). These two were real problems because projects plagued with bugs created by complexity and with memory leaks.[1]
The Java compiler provided by Sun Microsystems compiles Java code to bytecode, which requires the Java Virtual Machine (commonly referred to as a JVM) to execute. This model was adopted by Microsoft for C# and other .NET languages. IBM and others supply regular Java compilers for those who don't want to use the virtual machine.
Java applications are popular in creating applets for websites, due to their cross-platform nature. It still has not gained widespread popularity in stand-alone Windows applications, but is used primarily on web servers.
Google's Dalvik, based on Java, is a programming language used on Android. Oracle (who acquired Sun Microsystems in 2009) has filed a lawsuit alleging that Dalvik infringes Oracle's copyrights and patents on the Java programming language. The lawsuit is currently being tried, as of April 2012.
Memory Management
The Java programming language is based on Object Oriented programming principles, coupled with garbage collection. This means, unlike C and other lower level programming languages the developer is able to create programs without worrying about pointers, references and memory. Instead the Java Virtual Machine is able to manage objects that are in use, periodically deleting objects that are no longer referenced (and therefore no longer required by the program).
Example Code
Hello, World
An example program often used for languages is something that displays "Hello, World!".
public class World {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
GUI with JFrame
An example of creating and showing a JFrame with nothing in it:
JFrame frame = new JFrame(); frame.show();