Jump to content

Talk:Java (programming language)

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

This is an old revision of this page, as edited by SuperU (talk | contribs) at 05:19, 24 May 2010 (→‎About "write once run everywhere" in the introduction: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Former featured articleJava (programming language) is a former featured article. Please see the links under Article milestones below for its original nomination page (for older articles, check the nomination archive) and why it was removed.
Main Page trophyThis article appeared on Wikipedia's Main Page as Today's featured article on December 17, 2005.
Article milestones
DateProcessResult
March 23, 2004Featured article candidatePromoted
June 24, 2005Featured article reviewKept
July 25, 2006Featured article reviewDemoted
August 8, 2006Good article nomineeNot listed
June 15, 2008Peer reviewReviewed
Current status: Former featured article

Improved Hello World Example

The Hello World example should demonstrate object creation and the calling of an instance method. It should also probably have a field. Alas a balance between example and brevity must be struck.

/**
 * Outputs "Hello, World!" and then exits
 */
public class HelloWorld {
    public void greetWorld(PrintStream stream) {
        stream.println("Hello, World!");
    }
    public static void main(String[] args) {
        HelloWorld worldGreeter = new HelloWorld();
        worldGreeter.greetWorld(System.out);
    }
}

--DataSurfer (talk) 11:00, 15 January 2009 (UTC)[reply]

Would this be overkill?
package org.wikipedia.examples;
import java.io.PrintStream;  {{subst:Unsigned|1=DataSurfer|2=11:24, 15 January 2009 (UTC)}} <!--Autosigned by SineBot-->
/**
 * Outputs "Hello, World!" and then exits


 */
public class Greeter {
    String salutation;
    public Greeter(String salutation) {
        this.salutation = salutation;
    }
    public void greet(PrintStream stream, String target) {
        stream.println(salutation + ", " + target + "!");
    }
    public static void main(String[] args) {
        Greeter englishGreeter = new Greeter("Hello");
        englishGreeter.greet(System.out, "World");
    }
}

--DataSurfer (talk) 11:08, 15 January 2009 (UTC)[reply]

IMO, no. In general, a Hello World example should be the simplest possible program that displays "Hello world". Oli Filth(talk|contribs) 19:30, 15 January 2009 (UTC)[reply]

Eh I think that a simple system.out statement is easier. This is not a friendly welcoming to java for beginners. 208.102.210.16 (talk) 21:46, 1 May 2010 (UTC)armynavy123[reply]

Nothing on Android?

While there are many folks who feel that Android is not "pure Java", I think it warrants a mention because Android has numerous constructs from the Java language, including its syntax. I also think Java users would be interested in hearing about Android if they're not already familiar with it. —Preceding unsigned comment added by Wikigameshow (talkcontribs) 18:29, 19 January 2009 (UTC)[reply]

Optimized OddEven

// OddEven.java
import javax.swing.JOptionPane;
 
public class OddEven {
    public static void main(String[] args) {
	System.out.println(
	 (
	  (new Integer(
		JOptionPane.showInputDialog("Please Enter A Number")
	  ) & 1
	 )
	)==0 ? "Even" : "Odd");
    }
}

I don't think this could help users to understand Java. It looks like something coming from Perl or C obfuscated programs contests. Plus it does not handle inputs that are not integers. Hervegirod (talk) 20:20, 14 March 2009 (UTC)[reply]

Pronunciation

I've heard both ['dʒɑvə] (American) and ['dʒævə] (Canadian). I'm pretty sure the American pronunciation is closer to the original since the real name of the island, Jawa, is awkward to pronounce the Canadian way. Incripshin (talk) 19:00, 29 July 2009 (UTC)[reply]

User spreading unsourced POV views on the article

An unregistererd user signing doneon many of his contributions (he is often using Special:Contributions/128.206.82.56 IP) is spreading FUD on Java performance, and repeatedly revert other people edits in order to give his own personal view. He is obviously convinced that Java is very slow compared to C, and has started to modify this article according to his own views. He has recently edited (and already reverted) the Performance optimizations paragraph with the sentence: "however there are cases where Java is more than 30 times slower than C"[1]. The problem is that the benchmark he quote compares GNU GCC with Java with the -Xint flag, so with purely interpreted Java. When I reverted this with this explanation, he replied on the Talk page:You obviously didn't read the reference. There is also a server mode. This article reports best case scenario, there are also worst case scenarios (which he did not provide of course). I don't want to engage in an edit war, but I think that something needs to be done to stop his WP:POV behavior on this article. Hervegirod (talk) 22:15, 30 July 2009 (UTC)[reply]

Is someone maybe going to protect the article then so he can't edit it and is forced to get a real username to edit on Wikipedia? --Tustin2121 (talk) 14:51, 31 July 2009 (UTC)[reply]
I am glad I didn't donate to the wiki if this is the kind of article that is promoted. Maybe I should file litigation with the wikipedia for spreading false information about the performance of computer language. I have used java and seldom is java, "as fast" as C, in fact I know there are simple programs that can stump java and take many minutes compared to seconds with C. I think the Ubuntu shoot out is a good article that compares many languages. I also believe that this is a marketing based article. If you look at people like Olifilth and cybercobar, you will see that they actually are or were paid by Sun. This is not a marketing brochure. —Preceding unsigned comment added by 128.206.82.56 (talk) 18:52, 31 July 2009 (UTC)[reply]
You have the right to think what you want about Java or any other subjects, but wikipedia is not about what editors think. Original research and Personal views are banned here. Also speculating on the real life identity of another editor may constitute WP:OUTING, which is a serious offense here. I strongly advise you to stop this. This means you should immediately revert your speculation about their identities from the Talk page. Hervegirod (talk) 22:28, 31 July 2009 (UTC)[reply]
I didn't speculate it is on their wall. And meat puppets are prohibited. —Preceding unsigned comment added by 99.195.196.136 (talk) 03:35, 1 August 2009 (UTC)[reply]
Sorry about that only thumperward, also known as chris cunningham is sun microsystems, I think Oli used to be but his page no longer has anything on it. —Preceding unsigned comment added by 99.195.196.136 (talk) 03:41, 1 August 2009 (UTC)[reply]
I don't know where you got that idea from! I have never been employed by Sun, nor did it ever say so on my user page... Oli Filth(talk|contribs) 08:43, 1 August 2009 (UTC)[reply]
Ditto. Ironically, I dislike Java on the whole (I'm a Python guy myself, as referenced by my username); but I recognize that doesn't merit making its article potentially biased/inaccurate. But more relevant than any possible POV-pushing, the problem was that sources/sourcing weren't being followed quite closely enough. --Cybercobra (talk) 09:13, 1 August 2009 (UTC)[reply]
Sigh still having this converastion still thing java is fast as C yadda yadda, it all comes down to rate of fire. The bottom line is C is faster in every case, every time. You want to discuss more lets go. Not original research not personal experience its just plain Sun garbage, and the prosyltization. Do they really call them java evangelists, yes they do. —Preceding unsigned comment added by 99.195.196.136 (talk) 03:48, 1 August 2009 (UTC)[reply]
I have signaled your behavior to the noticeboard. Hervegirod (talk) 08:54, 1 August 2009 (UTC)[reply]
That seems a tad excessive, although I agree he violated wikiquette in the above comments. --Cybercobra (talk) 09:18, 1 August 2009 (UTC)[reply]
I consider WP:OUTING a serious offense. The outing attempt is the only reason I put it on noticeboard. Hervegirod (talk) 09:42, 1 August 2009 (UTC)[reply]
Whats the matter Herv you want to be anonymous? —Preceding unsigned comment added by 99.195.196.136 (talk) 15:46, 1 August 2009 (UTC)[reply]
quote from WP:OUTING: Posting such information about another editor is an unjustifiable and uninvited invasion of privacy and may place that editor at risk of harm in "the real world". This applies whether the person whose personal information is being revealed is a Wikipedia editor or not. It also applies in the case of an editor who has requested a change in username, but whose old identifying marks can still be found. Any edit that "outs" someone must be reverted promptly, followed by a request for Oversight to delete that edit from Wikipedia permanently. Hervegirod (talk) 16:40, 1 August 2009 (UTC)[reply]
Look those are wiki's rules, if people are allowed to maintain an anonymous stance about questionable material, then wiki is responsible for the content of the web site. IE if the person spreading the misinformation IE java performs as good or better than C with no qualification about its severe performance deficits, then Wiki is liable for the spread of misinformation. —Preceding unsigned comment added by 99.195.196.136 (talk) 17:36, 1 August 2009 (UTC)[reply]

Furthermore, while it is some people's job to evangelize and sell Java. It is not my job to correct the eroneous statements. I shouldn't have to do it, it makes me upset that the wiki resource is being used in this manner, and I don't care if I upset people using the resource for the purpose of evangelizing Java. —Preceding unsigned comment added by 99.195.196.136 (talk) 18:15, 1 August 2009 (UTC)[reply]

Get a good language to sell. —Preceding unsigned comment added by 99.195.196.136 (talk) 19:10, 1 August 2009 (UTC)[reply]
I reverted a couple more edits from 128.206.82.56 (talk, who seems intent on slanting the article to their own POV. The "evangelism" stuff is inappropriate to an article describing a program language; if Sun/Oracle is engaged in Java "evangelism" (and, as Java is a part of their product strategy, they probably are to the extent of "advertising" it), anything notable about this activity is more apropos to Sun/Oracle company pages than to a general description of a language that has also been implemented by independent FOSS projects. If there are issues with the wording of the performance section, go to town on fixing it, but the info that's there pretty much matches up with what's been published. evildeathmath 15:48, 23 September 2009 (UTC)[reply]
This seems to have be reverted again by the IP user; I have at this point incorporated the one actual fact from the "Evangelism" section into "History" (a quote from Rich Green that I'm not actually sure is all that relevant), and removed the rest, which remains idle speculation about what "some" may "believe". The IP user has also removed half of the performance section again; since the missing paragraph is an exact duplicate of part of the lede of the Java performance article, I've left that alone other than restoring the link to Java performance. evildeathmath 20:06, 23 September 2009 (UTC)[reply]

This article was proposed for deletion on the grounds of unfixable original research. I deprodded as it seemed to me that a comparison between the two was reasonable, but I don't know enough about computer programming to properly assess and fix the article. Any assessments of it and editing would be welcome. Fences&Windows 16:05, 8 August 2009 (UTC)[reply]

The problem for me is: these two languages are so different that is it really possible to compare them effectively ? And further: it seems that there is an interest in comparing the two languages because I see that one of the links is a wiki just about this comparison. What are the use cases that make such a comparison interesting, or even switching from one language to another interesting (it is obvious for general purpose languages) ? Perhaps the comparison would be really a useful article if it shows that some of the use cases for the two languages overlap (i.e., for ABAP, because I think hat Java is a more general purpose language) ? I'm not trying to say that one language is better than the other, I'm just asking (even myself) questions that pop in my mind whose answers could improve this comparison article IMHO. Hervegirod (talk) 16:20, 8 August 2009 (UTC)[reply]
The idea that java is more general is a farce promoted by naive programmers and Sun executives. Its not more general, becuase it lacks several key features that prevent this.
  1. Java is slower.
  2. Java lacks compiler directives so it isn't actually cross platform.
  3. Java lacks the ability to do memory allocation, see why java is slower.

These are defects in the language itself, and not implmentaion specific, IE a mature language needs to be able to adapted to the environment it is run in to ensure similar behavious, java operates under the assumption that all environements should be the same. There are reasons why some DLL's and SO's operate differently and it is foolish to try claim that they are the same or make them be the same. The one technical reason for using java being that it can be run under a restricted security model is no longer an advantage, since any language can be run in a sandbox with modern operating systems. —Preceding unsigned comment added by 128.206.82.56 (talk) 16:32, 10 August 2009 (UTC)[reply]

this is blatant WP:OR and WP:POV. ABAP is a language for programming SAP Web application Server, it seems a little (to say the least) more restricted than Java. It is not a default in ABAP however, the two languages have different use cases. And the article proposal was not even about Java speed, but a language comparison. Hervegirod (talk) 17:22, 10 August 2009 (UTC)[reply]
Now at AfD. Fences&Windows 00:14, 15 August 2009 (UTC)[reply]

Stuff removed from Boolean data type article

The following section was removed from the article Boolean data type:
begin removed text



In the Java programming language, Boolean variables are represented by the primitive type boolean. The Java Virtual Machine (JVM) abstracts away from the actual representation in memory, so JVM writers can represent Boolean values in whatever manner is convenient (for example, one byte, or one word).

The Java Language Specification does not permit any explicit or implicit casts to or from boolean. Thus, it requires the compiler to reject this code:

int i = 1;
if (i)
  System.out.println("i is not zero.");
else
  System.out.println("i is zero.");

because the integer variable i cannot be cast to a Boolean type, and the if statement requires a boolean condition.[2]

In Java, boolean values (like other primitive types) can be appended to Strings. This feature provides a default visual representation of a Boolean value (true is displayed as "true" and false as "false").[2]

Another way to use Boolean values is to set a variable type as a Boolean type. This can be done in the following:

boolean i;       //the variable i is boolean
i = true;          //sets the value to true
if (i){
     System.out.println("i is true");
}else {
     System.out.println("i is not true");
}

boolean used with a switch statement:

boolean i = true;     //we can also set the  value of the variable in the same line that it is being declared
switch(i){
     case true:
          System.out.println("i is true");
          break;
     case false:
          System.out.println("i is not true");
          break;
}


end removed text
Is there a place for this text in the Java-related articles? Perhaps in the Wikibook? Thanks, and all the best, --Jorge Stolfi (talk) 23:37, 30 December 2009 (UTC)[reply]

Automate archiving?

Does anyone object to me setting up automatic archiving for this page using MiszaBot? Unless otherwise agreed, I would set it to archive threads that have been inactive for 30 days and keep ten threads.--Oneiros (talk) 22:31, 24 January 2010 (UTC)[reply]

 Done--Oneiros (talk) 19:48, 27 January 2010 (UTC)[reply]

"syntax" merge / examples section

two questions:

  1. what's w/the "merge" notice on the article Java syntax, yet it's linked as a "main article" in the section on this page? i think it should remain separate and be fleshed out.
  2. is the "examples" section supposed to be a subheader of the syntax section, esp. in that it discusses primarily syntax and keywords?

Kevin Baastalk 14:37, 17 March 2010 (UTC)[reply]

anyone? Kevin Baastalk 13:33, 31 March 2010 (UTC)[reply]
I agree. Java's syntax, though similar to C++'s, warrants a separate article.  dmyersturnbull  talk 00:07, 11 April 2010 (UTC)[reply]
I also think that merger is inappropriate. I will try to bring the article to the normal size with decent contents based on other languages' syntax pages, it won't look like it should be merged. HotXRock (talk) 12:35, 18 April 2010 (UTC)[reply]

Criticism

Criticism of Java used to be a standalone article (albeit a very stub-like one). With as much Java-bashing as goes on on the Internet, are there really so few legitimate problems with it that this article needs none? I don't see any criticism at all, aside from the description of the garbage collector potentially causing a pause in execution.

I am not asking to prove a point; I'm not experienced enough with Java to answer this question myself. Mhoskins (talk) 15:59, 17 May 2010 (UTC)[reply]

It got merged, but the merge wasn't executed in the best way, imo. I keep meaning to re-do it myself, but haven't gotten around to it. --Cybercobra (talk) 18:36, 17 May 2010 (UTC)[reply]

About "write once run everywhere" in the introduction

I am not sure if write once run everywhere should be allowed to continue on wiki.Infact the major problem JAVA faces is that of portability and the slogan should be "Write once debug everywhere" comments anyone?

  1. ^ {{cite web |url=http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=gcc&lang2=javaxint&box=1 |title=The Computer Language Benchmarks Game
  2. ^ a b Java Language Specification, 3rd edition - online at http://java.sun.com/docs/books/jls/