Talk:Java syntax

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

From WP:RfD[edit]

Semantics and BNF grammar[edit]

Anybody reading this article could be forgiven for thinking that Java did not include any semantic requirements (ie, the article reads like everything is specified in the syntax).

This article could do with a major rewrite that separated out the lexical/syntax/semantic issues. And come on guys, an article on syntax that fails to list at least a few production from the BNF grammar :-O.

Come to think about it, the problem is not the content but the title. The title "A brief introduction to some Java features" is closer to what the text is about. Derek farn 15:41, 24 April 2006 (UTC)[reply]

Java 5 features[edit]

This article does not cover Java annotations or generic/parameterized types. Mike Dillon 15:56, 9 August 2006 (UTC)[reply]

Book References[edit]

Herb Schildt is widely regarded as being one of the worst technical authors around[1]. Should we really be referencing one of his books at the bottom of the article - especially since theres no shortage of other books on Java. 82.71.7.193 22:05, 29 August 2006 (UTC)[reply]

Operator precedence needed[edit]

I don't have time at the moment, but the article should indicate the operator precedence and discuss operator precedence. —Doug Bell talkcontrib 20:33, 3 November 2006 (UTC)[reply]

why did somebody delete the chinese java example?[edit]

http://en.wikipedia.org/w/index.php?title=Java_syntax&diff=130736395&oldid=123256628 Booksonlysuc 01:19, 1 August 2007 (UTC)[reply]

My theory is that some overzealous editor saw the Chinese characters and decided to translate for us, without realizing they were intentional. I restored them. --Max Talk (add) 01:45, 1 August 2007 (UTC)[reply]

things needed[edit]

  • Exception
  • Thread object, Runnable interface and their methods
  • synchronized block
  • local variables and their scope
  • Autoboxing

anything else? 220.146.142.210 11:48, 22 August 2007 (UTC)[reply]

Wrapper types as "pass-by-reference"?[edit]

Aren't wrapper types immutable? If so, they cannot be used to pass by reference as the article says 201.21.71.226 (talk) 01:40, 25 December 2008 (UTC)[reply]

Stubbing this pending rewrite[edit]

The recent AfD for this article came up as no consensus, but that was mostly due to the potential use of an article on this subject rather than anything which currently exists in it. I've taken the opportunity to remove the useless material pending a full rewrite from scratch, as its existence made that less likely; it was, of course, quickly reverted by anon complaining about it being "destroyed". if there's no better argument for restoring the cruft which has now been transwikied to a WikiBooks manual (where it belongs) then I'll remove it again. Chris Cunningham (not at work) - talk 09:26, 6 February 2009 (UTC)[reply]

  • I support the stubbing suggestion based on the history and the result of the AfD. Wikipedia is not and all that. Give it a couple of more days and then redo it. If it is again summarily reverted w/o comment here, at least you'll clearly be in the right. Usrnme h8er (talk) 15:01, 9 February 2009 (UTC)[reply]
I've now restored the stubbed version, as there has been no response from any party wishing to keep the old version - one which was generally disliked in the AfD. This gives the article room to re-grow as a descriptive rather than prescriptive work. Chris Cunningham (not at work) - talk 20:38, 18 February 2009 (UTC)[reply]
i'm sorely disappointed. the previous page was useful reference despite whatever your claim is that it's what wikipedia isn't supposed to be. may as well delete half of the mathematics articles that i reference in the same manner as i did this page. way to make wikipedia less useful than it should be. — Preceding unsigned comment added by 71.192.103.225 (talk)
What prevents you from accessing exactly the same article at b:Java Programming/Syntax? This isn't the Open University. Material which is purely instructional / educational belongs elsewhere. Wikibooks is that place. Chris Cunningham (not at work) - talk 11:25, 13 March 2009 (UTC)[reply]

Reverting due to Inconsistency with other existing syntax articles + adding Cleanup[edit]

I realize that I am raising this point after the recent AfD referenced above, but it seems pretty odd to me that almost each of the widely used prog. languages out there, with an article on wikipedia (C, C++, C#, JavaScript), also have a syntax article in a very similar structure (C# Syntax ...etc) to the previous format/content of this article. Thus, Java is now the only language on wikipedia of the same weight, yet a very lacking syntax page.
After reading the AfD, I understand that the argument made to clean/delete this article was based on valid policies such as those included and referenced from (WP: What Wikipedia is not), however, IMO the syntax articles for any of the aforementioned languages, fitting within one page of average length, can never be comprehensive enough to be considered a prescriptive user guide or manual. They are more of a brief overview of the syntactical properties, features and constructs of a language that are usually necessary to enable a basic differentiation between a programming language and another, which can be argued to be the most important part of even a high-level understanding a language. Moreover, if all the syntax articles are removed or reduced accordingly, where can we for instance point out to language properties such as the immutability of strings in Java, C# or JavaScript vs. C and C++? Such details should not be overloaded at the main language article, and yet can be very much argued to be encyclopedic material essential to give a feeling of programming languages evolution. IMO, that's was one of the reasons the syntax articles were created in the first place, and in their current format. This format may need a cleanup as requested in some syntax articles, but shouldn't be a reason for massive content deletion until proven otherwise.
Also, the fact that this content was copied/transwikied into wiki books can be argued to be not a valid justification for content/article deletion. The content was originally in this article and it can be copied and repeated in dozen other sites yet do not pose an obligation to delete it from the article at hand. Particularly, that it even adds to the inconsistency where a user can check the syntax for the majority of the other languages by searching in wikipedia except now for Java.
The consensus reached in the AfD was to keep the article with an ongoing debate on rewriting it. Since no consensus have been reached on rewriting the article, and based on other policies such as WP:IMPERFECT and WP:PRESERVE am reverting the article back to its original form and adding a cleanup tag instead to allow the discussion for what to change to continue. Please do not revert back. --K.G. (talk) 23:00, 3 April 2009 (UTC)[reply]
There's nothing in that comment which justifies the restoration of the previous version, which has inevitably resulted in nine months of edits which have done nothing to address the points made previously regarding the article content. I would implore future editors to work on the Wikibooks article if they believe that the previous content was worthwhile. Chris Cunningham (not at work) - talk 23:01, 27 January 2010 (UTC)[reply]

Reverting due to Inconsistency with other existing syntax articles[edit]

What kind of argument is that?

If the other existing syntax articles are crap, it does not mean, that this one should be the same.

There is no use of this article at all after the last improvement.

Is the goal of Wikipedia to be understandable to every mere mortal, who has no interest of Java or any other programming language?

Yet I wish you luck and keep administring! --62.65.212.117 (talk) 16:50, 28 January 2010 (UTC)[reply]

Wikipedia will end up to be a "rate my contribution" page unless we can get rid of self-admiring moderators.

Whoever was the lord, who replaced the real syntax overview with this tabloid news, please be so nice and think about the interests of users of Wiki and not the virtual career!

I need the information, that was here and not the joke, what has remained.

--62.65.212.117 (talk) 19:13, 28 January 2010 (UTC)[reply]

What you "need" is available on WikiBooks by following this link. WikiBooks contains a host of information on programming; its purpose is to serve as this sort of repository. Wikipedia is not intended to be everything to everyone; it will tell you what an aircraft is but is not expected to teach you how to fly one. Would that more people in the less-well-travelled parts of the encyclopedia considered this before dumping their life experiences into pages indiscriminately. Chris Cunningham (not at work) - talk 10:44, 29 January 2010 (UTC)[reply]

Image of syntax shows a global function[edit]

The code shown in the image is not valid Java being that there is no enclosing class - is that appropriate? —Preceding unsigned comment added by 220.237.145.215 (talk) 11:25, 24 February 2011 (UTC)[reply]

It's not a valid Java program. But it is valid code nonetheless, and it is said that it's just a code snippet. HotXRock (talk) 14:05, 6 April 2012 (UTC)[reply]

What import actually does[edit]

  • The import statement loads a specific class or classes from a referenced package.

Does import actually load the class, in the sense of adding all the code from the API into your program? Or does it just tell the compiler where to look?

I thought all the compiled code in the API is already in the virtual machine. Someone downloading, say, an applet from a website wouldn't be downloading the entire util package with a statement like

import java.util.*

Is this correct --Uncle Ed (talk) 14:17, 7 March 2012 (UTC)[reply]

You are right, the import declaration doesn't actually load anything, it only allows to use shorter names for the classes in the file. It doesn't influence the actual code which is produced by a compiler. I'll fix this. HotXRock (talk) 18:54, 7 March 2012 (UTC)[reply]
Thanks, man, you rock! :-) --Uncle Ed (talk) 22:17, 7 March 2012 (UTC)[reply]

Single Element Annotations[edit]

According to the JLS 9.7.3, this only works if the omitted element name is 'value'. Seemed to be true when I tested it out. OK to change the wording on this example to use 'value' instead of 'fileSystemOperations'? Along the lines of...

The other short form is called single element annotation. It is used with annotation types where one element is named 'value' and all the other elements have default values. In single element annotation :form the element name is omitted and only value is written instead:
/* Equivalent for @BlockingOperations(value = true).
networkOperations has a default value and
does not have to be assigned a value */
@BlockingOperations(true)
void openOutputStream() {"
}

Faolin42 (talk) 23:10, 8 October 2013 (UTC)[reply]