• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

What the different between C++ and java

kellythomus

New Member
I want learn oops language but i am confuse witch oops language are best c++ or java, so give suggestion, who is the best and whta the different between c++ and java.
 
For learning, I would say it depends. If you have a good book or guide, or instructor, and you want to get in-depth, I'd go for C++. It'll allow you to get down the basics of OOP and allow you to get a better understanding of data structures by implementing them yourself.

Java is maybe a little simpler to figure out from a beginner's point of view, so I'm learning towards it. You don't have to worry about memory management, pointers, or implementing your own data structures to do some really cool things. Java has a garbage collector to do memory management for you, and most data structures are already implemented for you, so you can get right down to learning about syntax and data types and what all that "public static void main" business means, and how classes/objects are used, etc. The technical stuff is still very useful to know!

Both languages are very "C like" (C++ obviously being more so haha), so if you learn one, the other will come very quickly to you.

Outside of those two, I've heard Python and C# are good choices for beginner languages, too, though I have no experience with them.
 
Are you just wanting to learn OOP? You don't need to use C++ or Java for either, you can use PHP. But I'd vote C++.
 
C++ is for beginners and it is much closer to processor and java is not for beginners So i recommend you if you are new in programming then frist use C++.
 
JAVA- Java does not support pointers, templates, unions, operator overloading, structures etc.Java support automatic garbage collection. It does not support destructs as C++ does.Java does not support conditional compilation and inclusion.Exception handling in Java is different because there are no destructors.

C++ - C++ supports structures, unions, templates, operator overloading, pointers and pointer arithmetic.C++ support destructors, which is automatically invoked when the object is destroyed.Conditional inclusion is one of the main features of C++.While in C++, you may not include the try/catch even if the function throws an exception.

WEB HOSTING
 
For java you won't need to worry about which platform you are developing, the JVM takes care for you.

Java is strictly OOP. One thing not mentioned yet, is that Java does not support multiple inheritance, this can be seen as a pro or con, depends on your point of view, probably a big down is not supporting operator overloading because it will make simpler things like "object_A + object_B" into "object_A.sum(object_B)" (ugly).

Overall, Java provides you a more controlled environment at the cost of less freedom like C++ could give you
 
I want learn oops language but i am confuse witch oops language are best c++ or java, so give suggestion, who is the best and whta the different between c++ and java.

Here are the key differences

1 ) In c++, you can have multiple inheritance, operator overloading.
Java does not have multiple inheritance and operator overloading

2) C++ have 3 Access specifiers public, private, protected
java have 4 access specifiers public,private,protected,default

3) java pure object oriented language everything is object here
c++ is a procedural oriented language

4) C++ have pointers
java doesnot have pointers

5) c++ its our responsibility to allocate and deallocate the memory
In java allocating memory is programmer responsibility. Deallocating taken care by the JVM.


Regards,
Adrian
 
C++ and Java are both popular programming languages, but they differ in several ways:

1: Syntax: C++ and Java have different syntaxes. C++ is a low-level programming language that requires more manual memory management, whereas Java is a high-level programming language that uses automatic garbage collection to manage memory.

2: Object-Oriented Programming: C++ and Java are object-oriented programming languages but differ in implementing certain features. For example, C++ supports multiple inheritances, which allows a class to inherit from multiple base classes, while Java only supports single inheritance.

3: Platform independence: Java is known for its platform independence, meaning that Java code can be executed on any platform with a Java Virtual Machine (JVM). C++ code, on the other hand, C++ code is compiled into machine code specific to the platform it is being compiled on.

4: Performance: C++ is generally considered faster than Java because it is compiled directly into machine code, whereas the JVM interprets Java code. However, the difference in performance can vary depending on the specific application.

5: Memory management: C++ requires manual memory management, which can be more challenging but offer greater control over memory usage. Java uses automatic garbage collection, which makes memory management easier but can also lead to performance issues if not appropriately managed.
 
Back
Top