Current time: 05-23-2012, 02:33 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Java-Concepts-Java-Basics Seminar
12-14-2010, 04:26 AM
Post: #1

Java-Concepts-Java-Basics Seminar
Basic Java Syntax and Semantics
Methods, Messages, and Signatures
Classes implement methods, and objects are instances of classes.
Objects that share common behavior are grouped into classes.
An object responds to a message only if its class implements a corresponding method.
To correspond the method must have the same name as the message.
Messages are sometimes accompanied by parameters and sometimes not:
pen.move(); // No parameter expected
pen.moveDown(8); // One parameter expected

Basic Java Syntax and Semantics
Some methods return a value and others do not.
To use a method successfully we must know:
What type of value it returns
It’s name (identifier)
The number and type of the parameters it expects
This information is called the method’s signature.
Basic Java Syntax and Semantics
Programming Protocols: Use camelCase

When forming a compound variable name, programmers usually capitalize the first letter of each word except the first.
(For example: taxableIncome)

All the words in a program’s name typically begin with a capital letter (ComputeEmployeePayroll).

Constant names usually are all uppercase (TAX_RATE).
Comments
Comments are explanatory sentences inserted in a program in such a matter that the compiler ignores them.
There are two styles for indicating comments:
End of line comments:
These include all of the text following a double slash (//) on any given line; in other words, this style is best for just one line of comments
Multiline comments:
These include all of the text between an opening /* and a closing */
Additional Operators
Extended Assignment Operators
The assignment operator can be combined with the arithmetic and concatenation operators to provide extended assignment operators. For example:
int a = 17;
String s = "hi";
a += 3; // Equivalent to a = a + 3;
a -= 3; // Equivalent to a = a – 3;
a *= 3; // Equivalent to a = a * 3;
a /= 3; // Equivalent to a = a / 3;
a %= 3; // Equivalent to a = a % 3;
s += " there"; // Equivalent to s = s + “ there”;
Additional Operators
Increment and Decrement
Java includes increment (++) and decrement (--) operators that increase or decrease a variables value by one:
int m = 7;
double x = 6.4;
m++; // Equivalent to m = m + 1;
x--; // Equivalent to x = x – 1.0;
The precedence of the increment and decrement operators is the same as unary plus, unary minus, and cast.
Standard Classes and Methods
Eight methods in the Math Class
Standard Classes and Methods
Using the Math class

double absNum, powerNum, randomNum;

absNum = Math.abs(-30);
powerNum = Math.pow(-3, 3);
randomNum = Math.random();

Results:
absNum = 30 //Absolute value of -30
powerNum = -27 //-3 to the 2nd power
randomNum = ????? //Random number between 0 and 1


Attached File(s)
.ppt  Java-Concepts-Java-Basics.ppt (Size: 334 KB / Downloads: 3)
Find all posts by this user
Quote this message in a reply
Post Reply 


[-]
Share/Bookmark (Show All)
Facebook Linkedin Technorati Twitter Digg MySpace Delicious

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  UTILIZACION-DEL-IDE-ECLIPSE-y-JAVA-2003 Seminar born_for seminars 0 430 12-14-2010 04:42 AM
Last Post: born_for seminars
  Slides-de-Aula-Java-Micro-Edition-J2ME Seminar born_for seminars 0 337 12-14-2010 04:41 AM
Last Post: born_for seminars
  Sending-and-receiving-xml-in-java-application Seminar born_for seminars 0 230 12-14-2010 04:40 AM
Last Post: born_for seminars
  Ruby-On-Java Seminar born_for seminars 0 374 12-14-2010 04:40 AM
Last Post: born_for seminars
  Oracle-AS-Java-Object-Cache Seminar born_for seminars 0 176 12-14-2010 04:39 AM
Last Post: born_for seminars
  OOPs Through JAVA Seminar born_for seminars 0 195 12-14-2010 04:37 AM
Last Post: born_for seminars
  Object-Oriented-Programming-09-Transform-UML-to-Java Seminar born_for seminars 0 415 12-14-2010 04:37 AM
Last Post: born_for seminars
  Object-Oriented-Programming-02-Java-Fundamentals Seminar born_for seminars 0 194 12-14-2010 04:36 AM
Last Post: born_for seminars
  Network-programming-and-java-Sockets Seminar born_for seminars 0 344 12-14-2010 04:35 AM
Last Post: born_for seminars
  Multi Threaded Programming Seminar born_for seminars 0 192 12-14-2010 04:34 AM
Last Post: born_for seminars

Forum Jump:


User(s) browsing this thread: 1 Guest(s)