Nenda kwa yaliyomo

Java (lugha ya programu)

Kutoka Wikipedia, kamusi elezo huru
(Elekezwa kutoka Java (programming language))
Java
Duke (Java mascot) waving
Shina la studio namna : inaozingatiwa kuhusu kipengee

namna nyingi

Imeanzishwa Mei 23 1995 (1995-05-23) (umri 29)
Mwanzilishi James Gosling
Ilivyo sasa Ilivutwa na: Ada 83, C++, C#, Eiffel, Mesa, Modula-3, Oberon, Objective-C, UCSD Pascal, Object Pascal

Ilivuta: Ada 2005, BeanShell, C#, Chapel, Clojure, ECMAScript, Fantom, Gambas, Groovy, Hack, Haxe, J#, Kotlin, PHP, Python, Scala, Seed7, Vala

Mahala Sun Microsystems
Tovuti https://www.oracle.com/java/

Java ni lugha ya programu. Iliundwa na James Gosling na ilianzishwa tarehe 23 Mei 1995. Iliundwa ili kuumba programu kwa Android. Leo tunatumia Java SE 13. Ilivutwa na C++.

Historia

[hariri | hariri chanzo]

Ilianzishwa mwaka wa 1995 nchini Marekani. James Gosling, Mike Sheridan, na Patrick Naughton walianza kufanya kazi kuhusu Java mwaka wa 1991. Mwaka wa 1996 Sun Microsystems ilichapa Java 1.0.

Namna ya Java ni ile inaozingatiwa kuhusu kipengee na namna nyingi.

Sintaksia

[hariri | hariri chanzo]

Sintaksia ya Java ni ngumu sana; inafananishwa na lugha za programu nyingine kama JavaScript, Python au Ruby. Ilivutwa na sintaksia ya C++, lugha ya programu nyingine.

Mifano ya Java

[hariri | hariri chanzo]

Programu kwa kuchapa « Jambo ulimwengu !».

public class JamboUlimwengu {
    public static void main(String[] args) {
        System.out.println("Jambo ulimwengu !");
    }
}

Programu kwa kutafuta thamani katika jedwali.

class Mfano2 {
    public static void main(String[] args) {
        int[] table = {12, -5, 7, 8, -6, 6, 4, 78, 2};
        byte elt = 4;
        short i;
        for (i = 0; i < 8; i++) {
            if (elt == table[i]) {
                break;
            }
        }
        afficher(i, elt);
    }

    static void afficher(int rang, long val) {
        if (rang == 8) {
            System.out.println("thamani : " + val + " haitafutwi.");
        } else {
            System.out.println("thamani : " + val + " thamani anatafutwa in rank :" + rang);
        }
    }
}
  • Binstock, Andrew (May 20, 2015). "Java's 20 Years of Innovation". Forbes. Archived from the original on March 14, 2016. Retrieved March 18, 2016.
  • Chaudhary, Harry H. (July 28, 2014). "Cracking The Java Programming Interview :: 2000+ Java Interview Que/Ans". Retrieved May 29, 2016.
  • Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and annotations), after they were introduced in the similar (and competing) C# language. [1] Archived March 19, 2011, at the Wayback Machine [2] Archived January 7, 2006, at the Wayback Machine
  • Gosling, James; McGilton, Henry (May 1996). "The Java Language Environment". Archived from the original on May 6, 2014. Retrieved May 6, 2014.