Java Tutorials
How to easily Generate Random Numbers in Java
In this tutorial, we will learn about Generate Random Numbers- Using Java Random Class Using Java...
Java was released by Sun Microsystem in 1995. It was developed by James Gosling. It is a general-purpose programming language which was designed with a specific goal of allowing developers to write once run anywhere. Java application is compiled into bytecode that can run on any implementation of the Java Virtual Machine or JVM.
In this tutorial, you will learn more about:
C# is an object-oriented programming language, developed by Microsoft that runs on.Net Framework.
The name "C sharp" was inspired by musical notations. Here '#' symbol indicates that the written note must be made a semitone which is higher in pitch.
The Java language was initially called OAK. Originally, it was developed for handling devices and set-top boxes. Oak was a big failure. However, in 1995 Sun changed the name to Java and modified the language to take the benefit of the expanding World Wide Web development business.
14 years later, in 2009, Oracle Corporation acquired Sun Microsystems and took ownership of two of their products Java and Solaris.
Anders Hejlsberg is the key contributor to C# language development. In 1999, he built a team to develop a new language which was then called "Cool.". The project was approved and announced in July 2000 at the.Net Developers Conference. The language was later renamed as C#.
Here, is the list of few important characteristics of C# programming language:
| Parameters | Java | C# |
|---|---|---|
| Creation | Designed by Sun Microsystems. | Designed as part of Microsoft's .NET initiative. |
| Ecosystem | Has a huge opensource ecosystem. | Used to develop software for Microsoft platforms. |
| Support for generics | It is implemented using erasures and casts added upon compilation into bytecode. | Integrated into the CLI and allows type information to be available at runtime |
| Support for delegates | Requires use of an interface to achieve similar functionality. | Has delegates which serve as methods that can be called without knowledge of target object. |
| Checked exceptions | Only has one type of exception | Distinguishes between checked and unchecked exceptions |
| Polymorphism | Invokes the "virtual" keyword in a base class and "override" keyword in a derived class. | Enables polymorphism by default. |
| Designed for | Java programming language is intended to be run on a Java platform, by the help of Java Runtime Environment (JRE). | The C# programming language is designed to be run on the Common Language Runtime (CLR). |
| Safety type | Java type safety is safe. | C# type of safety is unsafe. |
| Built-in Datatype | Built-in data types that are passed by value are called simple types. | Built-in data types that are passed by value are known as primitive types. |
| Arrays | Arrays in Java are a direct specialization of Object. | Arrays in C# are a specialization of System. |
| Support for conditional compilation. | Java doesn't provide support for conditional compilation | C# supports conditional compilation feature with the help of preprocessor directives. |
| Support for Goto statement. | Java doesn't support the goto statement. | C# supports the goto statement. |
| Structure and unions | Java doesn't support structures and unions. | C# supports structures and unions. |
| Suited for | For concurrency and complex project. | It is mainly suited for game app development projects. |
| Installation | Requires JDK to run Java. | .Net framework provides a vast library of codes used by C# |
| Cross-platform support | Java is highly cross-platform with its byte code. | Compared to Java, C# need to improve on this feature. |
| IDE | Eclipse, NetBeans, IntelliJ IDEA | Visual Studio, MonoDevelop |
| Operator Overloading | No support for operator overloading | C# provides support for operator overloading for multiple operators. |
| Number of Public Classes | In Java, there is an only a single public class inside source code, or it will display compilation error. | In C#, there are multiple public classes included in the source code. |
| Control for API | It is controlled by an open community process. | Microsoft controls C# API. |
| Runtime Environment | Java supports JVM(Java Virtual Machine). | C# supports CLR(Common Language Runtime). |
| Platform Dependency | Java is a robust and platform independent language. | Code written in C# is windows specific. |
| Pointers | Java does not support pointers. | In C# you can use pointer only in an unsafe mode. |
| Floating point | Java supports strctfp keyword that means it results for a floating point will be the same for different platform. | C# does not offer support for strictfp keyword. This means that the result of floating point numbers may not be guaranteed to be the same across all platforms. |
| TIOBE Index | 1 | 6 |
| Famous companies using | Airbnb, Instagram, Spotify, Netflix, etc. | Stack Exchange, Microsoft, Coderus, Docplanner, etc. |
| Salary Range | The average salary earned by Java Developer is $102,633 per year in the United States. | The average salary for "C# sharp developer" is approximately $108,145 per year. |
Here, are pros/benefits of using Java-
Here, are pros/benefits for using C#
Here, are cons for using Java-
Here, are the cons of using C#
In this tutorial, we will learn about Generate Random Numbers- Using Java Random Class Using Java...
Download PDF 1) Explain what is Java Design Pattern? A design pattern is a language independent...
What is a Variable in Java? Variable in Java is a data container that stores the data values...
What are Cookies? A cookie is a piece of data that is stored on your computer to be accessed by...
What is Abstraction in OOP? Abstraction is the concept of object-oriented programming that "shows"...
In this tutorial, you will learn - Display Current Date in Java SimpleDateFormat: Parse and Format...