aspose file tools*
The moose likes Beginning Java and the fly likes Java or C++, Java questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java or C++, Java questions" Watch "Java or C++, Java questions" New topic
Author

Java or C++, Java questions

sahar eb
Ranch Hand

Joined: May 06, 2009
Posts: 38
Hello dear Ranchers,
I have some questions:
1) Is Java a client side or z server side language?
2)is there a difference between OO and inheritance?
3)what are the main reasons which most of software developers use JAVA? (except that Java is a very popular language and that it is platform independent and user friendly)
4)can you tell me what are the differences between C and JAVA in a very beginner level?
5)Why java is not as efficient as C++ when it comes to limited resources? and in what resources we usually face big amount of usage (memory, time or ..)?

I have searched all of this questions before posting, I was either not satisfied by the answer or did not understand it, So pleeeeeeease try to explain in a simple way!

Thank you soo much!
Sahar
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14435
    
  23

sahar eb wrote:1) Is Java a client side or z server side language?

Java is a general purpose programming language, you can use it for whatever application you want. It's used for both client side and server side software, although I would say it has had much more success as a language for server side programming than for desktop applications.

sahar eb wrote:2)is there a difference between OO and inheritance?

Inheritance is just one of the concepts that belong to object-oriented programming; OO is inheritance plus many other concepts.

sahar eb wrote:3)what are the main reasons which most of software developers use JAVA? (except that Java is a very popular language and that it is platform independent and user friendly)

One of the things that I think is one of the major advantages that it has over C++ is automatic memory management (garbage collection). Having to manually manage memory in C++ is the biggest source of bugs (memory leaks) in C++ programs.

sahar eb wrote:4)can you tell me what are the differences between C and JAVA in a very beginner level?

C and Java are quite different. To start, C is not an object oriented language - it's a procedural programming language. Java has inherited a number of features and syntax from C++ and C.

sahar eb wrote:5)Why java is not as efficient as C++ when it comes to limited resources? and in what resources we usually face big amount of usage (memory, time or ..)?

First of all, this is not always true. One problem for some special kinds of software is that garbage collection in Java can happen at unpredictable times, which can cause problems. For example for financial trading systems, it's very important that transactions are handled within milliseconds, and then it's unacceptable that the garbage collector pauses the program. For most other software, this isn't a problem.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

1. Java is considered server side programming language, but when it comes to GUI you can very well use swing or javafx according to your need. So you can say Java is both -server side and client side programming language.
2. Inheritance is a property of oo languages among others like encapsulation and polymorphism.
3. Wide use and support and numerous open source projects in Java encourages software engineers to use Java.
4. C is not object oriented while java is. There are many more features like memory management+api or you can say Java as a platform make your life easier.
5. what do you mean by efficiency here? Memory ? So java has GC which has better algorithms to return unused memory back to pool.
sahar eb
Ranch Hand

Joined: May 06, 2009
Posts: 38
Dear "esper de Jong" Thank you soo much for explaining soo clearly! and you too "harshvardhan ojha"!

yes, memory leakage and management is one of the issues but how about execution time of the program? Can we evaluate JAVA and C++ based on their execution time?? especially talking when dealing with a huge amount of data? for example running data mining algorithm on a database which has tera-bits of data! In that case can we say C++ is faster or more reliable? or that one of them has more flexibility with working on data distributed on cloud networks?

Sorry for asking too much questions I don't know If we can even evaluate the languages that way. Let me see what the seniors think ;)

Thanks, in advance.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14435
    
  23

That question is hard to answer. You can't say in general that Java is better or faster than C++ or vice versa. Both programming languages can be used for many different purposes, and neither one has clearly better performance than the other in general.

With both Java and C++ you can work with databases and process huge amounts of data and there's no reason to assume that C++ would be faster or more reliable than Java, or that one of them has more flexibility. So if you want to do these kinds of things there is no clear "you'd better use X instead of Y" answer.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11499
    
  16

sahar eb wrote:5)Why java is not as efficient as C++ when it comes to limited resources?

If I were a lawyer, I would object on the grounds of "assumption of facts not in evidence".

WHO says java is not as efficient? What proof do you have? Just because some kid wrote two programs, one in java and one in C++ that gave results where C++ was faster isn't evidence.

A poorly written java program may indeed be slower than a C++ one. But a well written java program may be faster.

Yes, there are things like the startup time of java can be longer. However, most programs start up once and run for hours/days/week, so that cost is really negligible.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Stevens Miller
Ranch Hand

Joined: Jul 26, 2012
Posts: 567
    
    4

1) Is Java a client side or z server side language?

Both. It's pretty good on x servers and y servers too, but not so hot on Σ or Ω servers, as those are Greek to Java.

2)is there a difference between OO and inheritance?

Yes. With OO, you have to use a lot of workers to get what you want. With inheritance, you just pay the estate tax.

3)what are the main reasons which most of software developers use JAVA?

That varies from one person to the next. In my case, it is because it gives me lots of reasons to use the word, "beans," and I think "beans" is an inherently funny word.

4)can you tell me what are the differences between C and JAVA in a very beginner level?

The principal diffference is that C will make you crazy because it has pointers, while Java will make you crazy because it does not have pointers.

5)Why java is not as efficient as C++ when it comes to limited resources?

Because it used up all its capital letters in Questions 3 and 4.



Seriously: welcome to the fun. Comparisons between these languages are easy to find. Try this one, this one, or this one, just to get you started.

If you are wholly new to programming, you might want to start with just plain C (not even C++), but it certainly isn't necessary (and, if you do too much C, you might find grasping OO concepts harder than if you just started in Java or C++ in the first place; I programmed in C for 25 years and am still paying the price for it).

This is a good place to ask for help as you get into Java. Good luck!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java or C++, Java questions