Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Can one not learn Java without knowing C? And C without machine or assembly languages?(understanding the perspective of Java using analogies of c)
Can one not learn Java without knowing C? And C without machine or assembly languages? [message #1768148] Fri, 14 July 2017 07:32 Go to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
I posted a detailed post here which was thoroughly formatted and edited:
Can one not learn Java without knowing C? And C without machine assembly languages?
So I wouldn't like to reformat and repost here. Just a
Right-Click/Open Link in New Tab
will suffice to peruse the said page.

I got a plethora of posts.

But then, the doubt remains. Could a kind individual please explain the line from http://docs.oracle.com/javase/tutorial/getStarted/application/index.html, that is, Please demarcate what exactly each string is, and which one is the array:
Quote:
This array is the mechanism through which the runtime system passes information to your application. For example:

java MyApp arg1 arg2

Each string in the array is called a command-line argument.


[Updated on: Fri, 14 July 2017 08:04]

Report message to a moderator

Re: Can one not learn Java without knowing C? And C without machine or assembly languages? [message #1768195 is a reply to message #1768148] Fri, 14 July 2017 13:50 Go to previous messageGo to next message
Christopher Hoffman is currently offline Christopher HoffmanFriend
Messages: 11
Registered: December 2015
Junior Member
It's been a while since my intro to computer engineering course however you are right in your logic. I'm sure someone can correct me when I get fuzzy.

An array is simply an allocated space in memory dedicated to your desired memory type, in this case a string. A string is an array of characters. A character on a 64 bit processor is represented in memory as a series of bytes? A byte is a series of zero's and ones that define the value of a character according to a format known as encoding. Zero's and ones make up the binary logic on which all computations are based. A transistor can only be in two states, on or off. The processor I believe is a large number of really small transistors that alternate between the on and off state which allows binary computation. This is known as machine code. An executable is simply a binary file that contains a large number of zero's and one's that is executed to reproduce a desired computer state.

If you want to start from the beginning, Computer Science degrees start with Introduction to Logic, which goes through binary logic. They usually couple that with an introductory programming course that starts you with "Hello World" applications and you will be off to the races.

To understand the concept of the above line. You have to understand the concept of the black box. The black box takes input in, performs some kind of logic, and returns an output.

Java MyApp arg1 arg2 simply means you have a Java program called MyApp that takes two arguments. An argument is a fancy word for input. In this case the two inputs are strings.

An example of a string is "String"

So the App could perform a table lookup, dictionary lookup based on the string input and return the associated index of that string, for example. But MyApp could do virtually anything you want. The purpose of MyApp is abstracted out, all you know is it takes two inputs arg1 and arg2, until you start playing with the App.

[Updated on: Fri, 14 July 2017 14:07]

Report message to a moderator

Re: Can one not learn Java without knowing C? And C without machine or assembly languages? [message #1768199 is a reply to message #1768195] Fri, 14 July 2017 14:07 Go to previous messageGo to next message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Thank you sir, for replying. I know about arrays and strings. I wanted an idea w.r.t. that page I had linked: http://docs.oracle.com/javase/tutorial/getStarted/application/index.html
Kindly once again peruse the page via the link provided.
I will post the snapshotsindex.php/fa/30011/0/
&
index.php/fa/30012/0/
and request you to explain w.r.t. those snapshots.

[Updated on: Fri, 14 July 2017 14:11]

Report message to a moderator

Re: Can one not learn Java without knowing C? And C without machine or assembly languages? [message #1768203 is a reply to message #1768199] Fri, 14 July 2017 14:22 Go to previous messageGo to next message
Christopher Hoffman is currently offline Christopher HoffmanFriend
Messages: 11
Registered: December 2015
Junior Member
You're right it's not that clear. This is what happens when really smart people try to write tutorials.

A simple explanation is the input to MyApp takes an Array of Strings. The first index of the Array contains arg1, the second index of the array contains arg2. So the call could be MyApp(ArrayofStrings)
Since ArrayofStrings is an array of strings, the input is resolved into arg1 and arg2.


In python


ArrayofStrings = "test", "test2"

MyApp(ArrayofStrings)

The tutorial is also throwing another idea at you, and that is the idea of optional arguments. The main method has optional arguments which simply means you can call main like this
main()

If you want to pass arguments to main, you make an array of strings like above and pass it in like:
main(ArrayofStrings)

[Updated on: Fri, 14 July 2017 14:28]

Report message to a moderator

Re: Can one not learn Java without knowing C? And C without machine or assembly languages? [message #1768212 is a reply to message #1768203] Fri, 14 July 2017 17:34 Go to previous message
RajibKumar Bandopadhyay is currently offline RajibKumar BandopadhyayFriend
Messages: 58
Registered: July 2014
Member
Christopher Hoffman wrote on Fri, 14 July 2017 10:22
You're right it's not that clear. This is what happens when really smart people try to write tutorials.
A simple explanation is the input to MyApp takes an Array of Strings. The first index of the Array contains arg1, the second index of the array contains arg2. So the call could be MyApp(ArrayofStrings)
Since ArrayofStrings is an array of strings, the input is resolved into arg1 and arg2 ...


But also look at this portion:
Quote:
The main method accepts a single argument: an array of elements of type String.

public static void main(String[] args)


My question is: If the main method accepts only a single argument, how come it is an array of elements of the type string. There should only be one array of type String, an array having many character elements. So the statement should have been:
Amended Portion of that Note:
The main method accepts a single argument: an array of elementscharacters of typeforming a String.

public static void main(String[] args)


Don't worry, I got your point! It is possible in C, I know. So, it must also logically be possible in Java!

I was just trying to show how the writer made a mess of a simple point.

I thank you!

P.S. Please see for yourself how the CodeRanch forum has made a mess of this simple query I placed before them!

I also need an advice on this thread: A desired book as described herein

Regards

[Updated on: Fri, 14 July 2017 19:07]

Report message to a moderator

Previous Topic:Javadoc link color
Next Topic:"The catalog could not be loaded..." when installing Eclipse
Goto Forum:
  


Current Time: Tue Feb 18 23:08:22 GMT 2020

Powered by FUDForum. Page generated in 0.03482 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top