ReCom.org
Programming and Web Development Web monks and programmers welcomed

Learning programming basics using Javascript

Reply
 
Thread Tools
Xon
lazy bunny
Administrator
 
Xon's Avatar
 
Join Date: Mar 2007
Posts: 1,520
  #11 Old 26-10-2008 Default Re: Learning programming basics using Javascript

Luke,the random code in this page is manipulatable right?

i change the > and < and,different things show.

my question is how true is the math random? 50:50

if i dont change the sign,by chance i will get different "link" in that page,but i keep on refreshing the page and the link doesnt change unless i change the sign.
__________________
往者不可谏,来者犹可追。尔俸尔禄,民脂民膏,下民易虐,上天难欺。

Federation of Malaysia is formed by Sarawak, North Borneo, Malaya (and Singapore) by 16 Sept 1963. It has nothing to do with 31 Aug 1957. Just saying.
Xon is offline   Reply With Quote
luke Male
KittyLover
Administrator
 
luke's Avatar
 
Join Date: Nov 2003
Posts: 1,878
  #12 Old 26-10-2008 Default Re: Learning programming basics using Javascript

Unfortunately, random() functions in most popular programming languages are not really random since they generate the output using some sort of formula, thus their outputs are called pseudo-random. Most of these languages, however, provide another function to seed the random() function so that the pseudo-random outputs are at least not predictable by those who do not know the seed. That is, one can seed the random() function using a highly dynamic value, for example the current timestamp down to millisecond, and obtain an unpredictable pseudo-random number. Unfortunately, Javascript does not provide the seed function, thus outputs from Math.random() follow a certain pattern when called consecutively.
__________________
luke is offline   Reply With Quote
The Following User Says Thank You to luke For This Useful Post:
Athersin
Member
 
Athersin's Avatar
 
Join Date: Jul 2008
Posts: 416
  #13 Old 07-06-2009 Default Re: Learning programming basics using Javascript

If you are the new for java then you must learn the concept given below. First go through the following example and than you will be able to understand the basic logic the JAVA program .

First program in java..
Class A
{
public static void main(String arg[])
{
System.out.println("java is a very interesting language");
}
}


Logic behind the public method in JAVA

The public keyword is an access specifier, which allows the programmer to control
the visibility of class members. When a class member is preceded by public, then that member may be accessed by code outside the class in which it is declared. (The opposite
of public is private, which prevents a member from being used by code defined outside of its class.) In this case, main( ) must be declared as public, since it must be called by code outside of its class when the program is started.

Logic behind the static keyword in the above code.

The keyword static allows main( ) to be called without having to instantiate a particular instance of the class. This is necessary since main( ) is called by the Java interpreter before any objects are made.

Logic behind the void keyword in the above code.

The keyword void simply tells the compiler that main( ) does not return a value.

Logic behind the void keyword in the above code.

In JAVA , main( ) is the method called when a Java application begins. Be careful that Java is case-sensitive. Thus, Mainis different from main. It is important to understand that the Java ompiler will compile classes that do not contain a main( ) method. But the Java interpreter has no way to run these classes. So, if you had typed Main instead of main, the compiler would still compile your program. However, the Java interpreter would report an error because it would be unable to find the main( ) method.

Logic behind the String arg[] in the above code.

In main( ), there is only one parameter. String args[ ] declares a parameter named args, which is an array of instances of the class String. (Arrays are collections of similar objects.) Objects of type String store character strings. In this case, args receives any command-line arguments present when the program is executed.


Logic behind the System.out in the above code.

System is a class.
Out is a static object.
Println() is the method of PrintStream class.
System.out refers to the standard output stream.
__________________
"You don't stop laughing because you grow old, you grow old because you stop laughing.?
Athersin is offline   Reply With Quote
Reply

Bookmarks

Tags
programming

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Basics day_dreamer Programming and Web Development 10 17-09-2011 12:36 PM
Javascript emoticons johnleemk Programming and Web Development 2 19-12-2005 01:48 AM
ECU Programming filarnski Programming and Web Development 3 15-11-2005 11:58 PM
WML programming dyenne10 Programming and Web Development 4 16-08-2004 12:26 PM
Javascript Hacking game littlebigone Programming and Web Development 2 21-07-2004 08:42 PM


All times are GMT +8. The time now is 05:50 PM.


Powered by vBulletin® Version 3.7.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

ReCom stands for Reborn Community. It has no affiliation with other organizations that may share the same name. The views expressed in this website solely represent the authors point of view and do not necessarily reflect the views of ReCom Anchors and other ReCom users.


 

Page generated in 0.14478 seconds with 14 queries