MESSAGE
DATE | 2015-03-25 |
FROM | Ruben Safir
|
SUBJECT | Subject: [LIU Comp Sci] Java Crimes
|
From owner-learn-outgoing-at-mrbrklyn.com Wed Mar 25 01:30:25 2015 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix) id 752EF16133C; Wed, 25 Mar 2015 01:30:25 -0400 (EDT) Delivered-To: learn-outgoing-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 28) id 68BCD16133E; Wed, 25 Mar 2015 01:30:25 -0400 (EDT) Delivered-To: learn-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id 6C3A616133C for ; Wed, 25 Mar 2015 01:30:01 -0400 (EDT) Received: from [10.0.0.19] (unknown [96.57.23.82]) by mailbackend.panix.com (Postfix) with ESMTPSA id 1F1A7127D0 for ; Wed, 25 Mar 2015 01:30:01 -0400 (EDT) Message-ID: <551247D8.8020907-at-panix.com> Date: Wed, 25 Mar 2015 01:30:00 -0400 From: Ruben Safir User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: learn-at-nylxs.com Subject: [LIU Comp Sci] Java Crimes Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: owner-learn-at-mrbrklyn.com Precedence: bulk Reply-To: learn-at-mrbrklyn.com
This is just my opinion and I don't really care how many people disagreee, but java is a stupid programming language.
Read this spec. It looks like it came out of Green Eggs and Ham
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` Threads are the fundamental model of program execution in a Java program, and the Java language and its API provide a rich set of features for the creation and management of threads. All Java programs comprise at least a single thread of control—even a simple Java program consisting of only a main() method runs as a single thread in the JVM. Java threads are available on any system that provides a JVM including Windows, Linux, and Mac OS X. The Java thread API is available for Android applications as well. There are two techniques for creating threads in a Java program. One approach is to create a new class that is derived from the Thread class and to override its run() method. An alternative —and more commonly used — technique is to define a class that implements the Runnable interface. The Runnable interface is defined as follows: public interface Runnable { public abstract void run(); } When a class implements Runnable, it must define a run() method. The code implementing the run() method is what runs as a separate thread.
Figure 4.12 shows the Java version of a multithreaded program that determines the summation of a non-negative integer. The Summation class implements the Runnable interface. Thread creation is performed by creating an object instance of the Thread class and passing the constructor a Runnable object. ***Creating a Thread object does not specifically create the new thread; rather, the start() method creates the new thread. Calling the start() method for the new object does two things: 1.2.It allocates memory and initializes a new thread in the JVM. It calls the run() method, making the thread eligible to be run by the JVM.
***(Note again that we never call the run() method directly. Rather, we call the start() method, and it calls the run() method on our behalf.)***
ehhhh... feh
|
|