Contents - Cultural View
Contents - Cultural View Contents - Cultural View
Comparison of Java and C Sharp 82 [11] JSR 14: http:/ / www. jcp. org/ en/ jsr/ detail?id=14 [12] http:/ / gafter. blogspot. com/ 2004/ 09/ puzzling-through-erasure-answer. html [13] Java for Scientific Computation: Prospects and Problems (http:/ / www. pds. ewi. tudelft. nl/ pubs/ papers/ scicomp01. pdf) [14] Richter, Jeffrey (April 2001). "An Introduction to Delegates" (http:/ / msdn. microsoft. com/ en-ca/ magazine/ cc301810. aspx). MSDN Magazine. . Retrieved 2008-12-23. [15] Campbell, Dustin (9 February 2007). "What's In A Closure?" (http:/ / diditwith. net/ PermaLink,guid,235646ae-3476-4893-899d-105e4d48c25b. aspx). Did it with .NET. . Retrieved 2008-12-23. [16] Closures Coming in Java 7 (http:/ / java. dzone. com/ news/ closures-coming-java-7) [17] The Trouble with Checked Exceptions (http:/ / www. artima. com/ intv/ handcuffs. html) [18] Why doesn't C# have exception specifications? (http:/ / msdn2. microsoft. com/ en-us/ vcsharp/ aa336812. aspx) [19] http:/ / jacob-project. sourceforge. net/ [20] http:/ / j-integra. intrinsyc. com/ products/ com/ [21] O'Reilly, Tim (2006-08-02). "Programming Language Trends" (http:/ / radar. oreilly. com/ archives/ 2006/ 08/ programming_language_trends_1. html). Radar. O'Reilly. . [22] i-Technology Viewpoint: Java's Not Evolving Fast Enough (http:/ / au. sys-con. com/ node/ 163294) [23] Java 5 catches up with C# (http:/ / www. barrycornelius. com/ papers/ java5/ ) [24] JSR 14: Add Generic Types To The JavaTM Programming Language (http:/ / jcp. org/ en/ jsr/ detail?id=014) [25] Debate over closures for Java (http:/ / gafter. blogspot. com/ 2006/ 09/ debate-over-closures-for-java. html) [26] Property Support in Java, the Java Way (http:/ / www. javalobby. org/ java/ forums/ t88090. html) [27] CNET. "Sun, Microsoft settle Java suit" (http:/ / news. cnet. com/ 2100-1001-251401. html). . [28] http:/ / msdn. microsoft. com/ en-us/ library/ ms836794. aspx [29] http:/ / www. 25hoursaday. com/ CsharpVsJava. html [30] http:/ / www. javacamp. org/ javavscsharp/ [31] http:/ / www. osnews. com/ story. php?news_id=5602 [32] http:/ / www. csharphelp. com/ archives/ archive96. html [33] http:/ / msdn. microsoft. com/ en-us/ library/ ms228602. aspx [34] http:/ / www. geeks. ltd. uk/ Knowledgebase/ Compare-c-sharp-java. html [35] http:/ / www. ecma-international. org/ publications/ standards/ Ecma-334. htm [36] http:/ / java. sun. com/ docs/ books/ jls/ Comparison of Java and C++ This is a comparison of the Java programming language with the C++ programming language. Design aims The differences between the C++ and Java programming languages can be traced to their heritage, as they have different design goals. • C++ was designed mainly for systems programming, extending the C programming language. To this procedural programming language designed for efficient execution, C++ has added support for statically-typed object-oriented programming, exception handling, scoped resource management, and generic programming, in particular. It also added a standard library which includes generic containers and algorithms. • Java was created initially to support network computing. It relies on a virtual machine to be secure and highly portable. It is bundled with an extensive library designed to provide a complete abstraction of the underlying platform. Java is a statically typed object-oriented language that uses a syntax similar to C, but is not compatible with it. It was designed from scratch, with the goal of being easy to use and accessible to a wider audience. The different goals in the development of C++ and Java resulted in different principles and design trade-offs between the languages. The differences are as follows :
Comparison of Java and C++ 83 C++ Java Compatible with C source code, except for a few corner cases. No backward compatibility with any previous language. The syntax is however strongly influenced by C/C++. Write once compile anywhere (WOCA) Write once run anywhere / everywhere (WORA / WORE) Allows both procedural programming and object-oriented programming. Encourages an object oriented programming paradigm. Allows direct calls to native system libraries. Call through the Java Native Interface and recently Java Native Access Exposes low-level system facilities. Runs in a protected virtual machine. Only provides object types and type names. Is reflective, allowing metaprogramming and dynamic code generation at Has multiple binary compatibility standards (commonly Microsoft and Itanium/GNU) Optional automated bounds checking. (e.g. the at() method in vector and string containers) runtime. Has a binary compatibility standard, allowing runtime check of correctness of libraries. Normally performs bounds checking. HotSpot can remove bounds checking. Supports native unsigned arithmetic. No native support for unsigned arithmetic. Standardized minimum limits for all numerical types, but the actual sizes are implementation-defined. Standardized types are available as typedefs (uint8_t, ..., uintptr_t). Pointers, References, and pass by value are supported Explicit memory management, though third party frameworks exist to provide garbage collection. Supports destructors. Supports class, struct, and union and can allocate them on heap or stack Standardized limits and sizes of all primitive types on all platforms. Primitive data types always passed by value. Objects are passed by nullable reference (comparable to using pointers for all class or struct parameters in C++). [1] Automatic garbage collection (can be triggered manually). Doesn't have the concept of Destructor and usage of finalize() is not recommended. Supports only class and allocates them on the heap. Java SE 6 optimizes with escape analysis to allocate some objects on the stack. Allows explicitly overriding types. Rigid type safety except for widening conversions. Autoboxing/Unboxing The C++ Standard Library has a much more limited scope and functionality than the Java standard library but includes: Language support, Diagnostics, General Utilities, Strings, Locales, Containers, Algorithms, Iterators, Numerics, Input/Output and Standard C Library. The Boost library offers much more functionality including threads and network I/O. Users must choose from a plethora of (mostly mutually incompatible) third-party libraries for GUI and other functionality. added in Java 1.5. The standard library has grown with each release. By version 1.6 the library included support for locales, logging, containers and iterators, algorithms, GUI programming (but not using the system GUI), graphics, multi-threading, networking, platform security, introspection, dynamic class loading, blocking and non-blocking I/O, and provided interfaces or support classes for XML, XSLT, MIDI, database connectivity, naming services (e.g. LDAP), cryptography, security services (e.g. Kerberos), print services, and web services. SWT offers an abstraction for platform specific GUIs. Operator overloading for most operators Meaning of operators is immutable. Full multiple inheritance, including virtual inheritance. Single inheritance only from classes, multiple from interfaces. Compile time Templates Run time Generics Function pointers, function objects, lambdas (in C++0x) and interfaces No standard inline documentation mechanism. 3rd party software (e.g. Doxygen) exists. const keyword for defining immutable variables and member functions that do not change the object. No function pointer mechanism. Instead idioms such as Interfaces, Adapters and Listeners are extensively used. Javadoc standard documentation final provides a limited version of const, equivalent to type* const pointers for objects and plain const of primitive types only. No const member functions, nor any equivalent to const type* pointers. Supports the goto statement. Supports labels with loops and statement blocks.
- Page 35 and 36: Apache Shiro 31 Apache Shiro Develo
- Page 37 and 38: Java applet 33 there are frequently
- Page 39 and 40: Java applet 35 } } g.drawString("He
- Page 41 and 42: Java applet 37 The 2002 Sun - Micro
- Page 43 and 44: Java applet 39 [18] W3.org (http:/
- Page 45 and 46: Associació d'Usuaris de Java de Ca
- Page 47 and 48: Associació d'Usuaris de Java de Ca
- Page 49 and 50: Associació d'Usuaris de Java de Ca
- Page 51 and 52: Associació d'Usuaris de Java de Ca
- Page 53 and 54: Bean Scripting Framework 49 Bean Sc
- Page 55 and 56: CJAN 51 Ostensibly, CJAN.org failed
- Page 57 and 58: Chainsaw (log file viewer) 53 Chain
- Page 59 and 60: clone (Java method) 55 Alternatives
- Page 61 and 62: clone (Java method) 57 } } abstract
- Page 63 and 64: Comparison of Java and C Sharp 59 A
- Page 65 and 66: Comparison of Java and C Sharp 61 R
- Page 67 and 68: Comparison of Java and C Sharp 63 T
- Page 69 and 70: Comparison of Java and C Sharp 65 f
- Page 71 and 72: e="6.73"> = 42; = null; Comparison
- Page 73 and 74: Comparison of Java and C Sharp 69 L
- Page 75 and 76: Comparison of Java and C Sharp 71 I
- Page 77 and 78: Comparison of Java and C Sharp 73 t
- Page 79 and 80: Comparison of Java and C Sharp 75 N
- Page 81 and 82: Comparison of Java and C Sharp 77 L
- Page 83 and 84: Comparison of Java and C Sharp 79 T
- Page 85: Comparison of Java and C Sharp 81 C
- Page 89 and 90: Comparison of Java and C++ 85 e="7.
- Page 91 and 92: Comparison of Java and C++ 87 the c
- Page 93 and 94: Comparison of Java and C++ 89 • D
- Page 95 and 96: Comparison of Java and C++ 91 Sever
- Page 97 and 98: Comparison of the Java and .NET pla
- Page 99 and 100: Comparison of the Java and .NET pla
- Page 101 and 102: Comparison of the Java and .NET pla
- Page 103 and 104: Comparison of the Java and .NET pla
- Page 105 and 106: Constant interface 101 } public sta
- Page 107 and 108: Java 4K Game Programming Contest 10
- Page 109 and 110: Java 4K Game Programming Contest 10
- Page 111 and 112: CookXml 107 Creators, setters, adde
- Page 113 and 114: Cougaar 109 Cougaar Cougaar is a Ja
- Page 115 and 116: Devoxx 111 Related links • Devoxx
- Page 117 and 118: Elastic Path 113 References [1] htt
- Page 119 and 120: Electronic Disturbance Theater 115
- Page 121 and 122: Event dispatching thread 117 • Sw
- Page 123 and 124: Facelets 119 The above code can be
- Page 125 and 126: final (Java) 121 } Sphere(double x,
- Page 127 and 128: FormEngine 123 FormEngine Developer
- Page 129 and 130: Generics in Java 125 Motivation for
- Page 131 and 132: Generics in Java 127 Pair grade440
- Page 133 and 134: G-java 129 G-java G-java 2.x was a
- Page 135 and 136: GlassFish Metro 131 Features Metro
Comparison of Java and C++ 83<br />
C++ Java<br />
Compatible with C source code, except for a few corner cases. No backward compatibility with any previous language. The syntax is<br />
however strongly influenced by C/C++.<br />
Write once compile anywhere (WOCA) Write once run anywhere / everywhere (WORA / WORE)<br />
Allows both procedural programming and object-oriented<br />
programming.<br />
Encourages an object oriented programming paradigm.<br />
Allows direct calls to native system libraries. Call through the Java Native Interface and recently Java Native Access<br />
Exposes low-level system facilities. Runs in a protected virtual machine.<br />
Only provides object types and type names. Is reflective, allowing metaprogramming and dynamic code generation at<br />
Has multiple binary compatibility standards (commonly Microsoft<br />
and Itanium/GNU)<br />
Optional automated bounds checking. (e.g. the at() method in<br />
vector and string containers)<br />
runtime.<br />
Has a binary compatibility standard, allowing runtime check of correctness<br />
of libraries.<br />
Normally performs bounds checking. HotSpot can remove bounds checking.<br />
Supports native unsigned arithmetic. No native support for unsigned arithmetic.<br />
Standardized minimum limits for all numerical types, but the actual<br />
sizes are implementation-defined. Standardized types are available<br />
as typedefs (uint8_t, ..., uintptr_t).<br />
Pointers, References, and pass by value are supported<br />
Explicit memory management, though third party frameworks exist<br />
to provide garbage collection. Supports destructors.<br />
Supports class, struct, and union and can allocate them on heap or<br />
stack<br />
Standardized limits and sizes of all primitive types on all platforms.<br />
Primitive data types always passed by value. Objects are passed by nullable<br />
reference (comparable to using pointers for all class or struct parameters in<br />
C++). [1]<br />
Automatic garbage collection (can be triggered manually). Doesn't have the<br />
concept of Destructor and usage of finalize() is not recommended.<br />
Supports only class and allocates them on the heap. Java SE 6 optimizes with<br />
escape analysis to allocate some objects on the stack.<br />
Allows explicitly overriding types. Rigid type safety except for widening conversions. Autoboxing/Unboxing<br />
The C++ Standard Library has a much more limited scope and<br />
functionality than the Java standard library but includes: Language<br />
support, Diagnostics, General Utilities, Strings, Locales, Containers,<br />
Algorithms, Iterators, Numerics, Input/Output and Standard C<br />
Library. The Boost library offers much more functionality including<br />
threads and network I/O. Users must choose from a plethora of<br />
(mostly mutually incompatible) third-party libraries for GUI and<br />
other functionality.<br />
added in Java 1.5.<br />
The standard library has grown with each release. By version 1.6 the library<br />
included support for locales, logging, containers and iterators, algorithms,<br />
GUI programming (but not using the system GUI), graphics, multi-threading,<br />
networking, platform security, introspection, dynamic class loading, blocking<br />
and non-blocking I/O, and provided interfaces or support classes for XML,<br />
XSLT, MIDI, database connectivity, naming services (e.g. LDAP),<br />
cryptography, security services (e.g. Kerberos), print services, and web<br />
services. SWT offers an abstraction for platform specific GUIs.<br />
Operator overloading for most operators Meaning of operators is immutable.<br />
Full multiple inheritance, including virtual inheritance. Single inheritance only from classes, multiple from interfaces.<br />
Compile time Templates Run time Generics<br />
Function pointers, function objects, lambdas (in C++0x) and<br />
interfaces<br />
No standard inline documentation mechanism. 3rd party software<br />
(e.g. Doxygen) exists.<br />
const keyword for defining immutable variables and member<br />
functions that do not change the object.<br />
No function pointer mechanism. Instead idioms such as Interfaces, Adapters<br />
and Listeners are extensively used.<br />
Javadoc standard documentation<br />
final provides a limited version of const, equivalent to type* const pointers<br />
for objects and plain const of primitive types only. No const member<br />
functions, nor any equivalent to const type* pointers.<br />
Supports the goto statement. Supports labels with loops and statement blocks.