-
<font color='#000000'>import java.io.*;
public class Calculator
{
public static void main (String []args)
{
try
{ System.out.println("Enter first number:");
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in), 1);
String input1 = bufferedreader.readLine();
int num1 = Integer.parseInt(input1);
System.out.println("Enter second number:");
BufferedReader bufferedreader2 = new BufferedReader(new InputStreamReader(System.in), 1);
String input2 = bufferedreader2.readLine();
int num2 = Integer.parseInt(input2);
System.out.println(num1 + " + " + num2 + " is : " + add(num1,num2));
System.out.println(num1 + " - " + num2 + " is : " + subtract(num1,num2));
System.out.println(num1 + " * " + num2 + " is : " + multiply(num1,num2));
System.out.println(num1 + " / " + num2 + " is : " + divide(num1,num2));
}
catch(IOException io)
{
System.out.println(io.getMessage());
}
}
public static int add(int inte1 , int inte2)
{
return inte1 + inte2;
}
public static int subtract(int inte1 , int inte2)
{
return inte1 - inte2;
}
public static int multiply(int inte1 , int inte2)
{
return inte1 * inte2;
}
public static int divide(int inte1 , int inte2)
{
return inte1 / inte2;
}
}
That is a simple class which do some calculations if you have questions just list them and i will answer them insha'ALLAH
I know there will be good question so .... go a head</font>
-
<font color='#000000'><div align="left">
import java.io.*;
public class Calculator
{
public static void main (String []args)
{
try
{ System.out.println("Enter first number:");
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in), 1);
String input1 = bufferedreader.readLine();
int num1 = Integer.parseInt(input1);
System.out.println("Enter second number:");
BufferedReader bufferedreader2 = new BufferedReader(new InputStreamReader(System.in), 1);
String input2 = bufferedreader2.readLine();
int num2 = Integer.parseInt(input2);
System.out.println(num1 + " + " + num2 + " is : " + add(num1,num2));
System.out.println(num1 + " - " + num2 + " is : " + subtract(num1,num2));
System.out.println(num1 + " * " + num2 + " is : " + multiply(num1,num2));
System.out.println(num1 + " / " + num2 + " is : " + divide(num1,num2));
}
catch(IOException io)
{
System.out.println(io.getMessage());
}
}
public static int add(int inte1 , int inte2)
{
return inte1 + inte2;
}
public static int subtract(int inte1 , int inte2)
{
return inte1 - inte2;
}
public static int multiply(int inte1 , int inte2)
{
return inte1 * inte2;
}
public static int divide(int inte1 , int inte2)
{
return inte1 / inte2;
}
}
That is a simple class which do some calculations if you have questions just list them and i will answer them insha'ALLAH
I know there will be good question so .... go a head </div></font>
-
<font color='#000000'>اممممممم
كيف اعرف الـ class من الـ application ؟؟؟
في الـ new operetor ضروري اني اسوي invoke للـ constructor ؟؟؟
واشمعنى أن الـ method يكون static .. مثل معنى تواجدها في الـ function في الـ ++C ؟؟
والسموحه ..</font>
-
<font color='#E77471'><img src="http://oasis.bindubai.com/emoticons/wow.gif" border="0" valign="absmiddle" alt=':O'> <img src="http://oasis.bindubai.com/emoticons/wow.gif" border="0" valign="absmiddle" alt=':O'> <img src="http://oasis.bindubai.com/emoticons/wow.gif" border="0" valign="absmiddle" alt=':O'> <img src="http://oasis.bindubai.com/emoticons/wow.gif" border="0" valign="absmiddle" alt=':O'> <img src="http://oasis.bindubai.com/emoticons/wow.gif" border="0" valign="absmiddle" alt=':O'>
salaam all,
after all iam the one who is really confused with all these stuff,
i was really intersted to learn java script and i dont know why now i lose that interest
<img src="http://oasis.bindubai.com/emoticons/down.gif" border="0" valign="absmiddle" alt=':dd:'>
it is sound hard to me, you know what ? before learning visual basic i was really exicting <img src="http://oasis.bindubai.com/emoticons/tounge.gif" border="0" valign="absmiddle" alt=':p'> but now i dont because of our GREAT teacher <img src="http://oasis.bindubai.com/emoticons/mad.gif" border="0" valign="absmiddle" alt=':angry:'>
whatever, NOW i want to learn java and i want to know what kind of proggrame should i have and all the requirements and i will be greatful
thanx brothers and sisters <img src="http://oasis.bindubai.com/emoticons/blush.gif" border="0" valign="absmiddle" alt=':b:'></font>
-
<font color='#000000'>السلام والرحمه ..
الكرز المنسي ..
استخدم الـ JBuilder 8
..</font>
-
<font color='#000000'><div align="left">there is not a big difference , the class could be one of
the application's many classes or it could be itself the
application if the application has only one class and there
is a diiference between a stand-alone application and
a GUI application ... the first oneis a text or command-line
the second is a graphical user interface
For using the new operator you do not have to use it
if the constructor does not do anything that affect the
performance of the methods in the class you want to
call from so if the and if all the class methods are static
whic means you can call them by only putting the name of the class
and the name of the desired method and a dot in between like this :
MyClass.printName();
or a predefined method Math.random();
and so on static basic meaning is that there is only one
refrence of the method or of the variable is used by every object of that class
lets say we have a 3 classes 2 of them instantiate that
one class and each one get a value of a static variable and set it to a value so the first object getting the value of that variable will get the original value which the developer of that class usually set to 0 ... ,,, suppose that object set this varible to 5 for example ...then the second oject call that same variable what value would it get for it?<img src="http://oasis.bindubai.com/emoticons/rock.gif" border="0" valign="absmiddle" alt='???'>?? it will get 5 because it is only one copy used by all the objects and the same works for the static methods....hope that solve the problem , but my advice for now is that you think of the static method or variable is that you can call them without instantiating their calsses using the way mentioned above and then when <img src="http://oasis.bindubai.com/emoticons/biggrin.gif" border="0" valign="absmiddle" alt=':D'> you go further in programming you will know the cool difference.....any how always nice questions ...keep the good work up
Regards....</div></font>
-
<font color='#000000'><span style='color:darkblue'><div align="left">الكرزالمنسي
Sorry for being late to respond sister, now lets ge this straight...JavaScript is as i mentioned in the first posting a completely different language from the programming language Java which we are talikng about in this context...so which one you want to learn? i would assume that you want to learn Java so read the first and second posting please...but if you want to learn the JavaScript , HTML , or SQL ...i can open another topic for each one of those languages
ok..so much for that lets tell you how to download JDK (Java Development Kit)
you should go to java.sun.com and you will see this title
The Source for Java Technology and 3 buttons below it ...choose the Standard Edition j2SE and and then to in the middle to your right hand you will see a button with J2SE Downloads and click on that one button which will take you to choose a version so click on J2SE 1.4.1
and then in the next list click on the second row , second cloumn opposite to Windows (all languages, including English) and under SDK
then it will ask for info about you if you do not want to get e-mails about updates do not pay any attention ...just click on no thanks continue and then the second page at the end click accept and then go theough the downloading process... i recommond putting the file .exe into the C drive you will have and then you will have to set the class path if you are running WXP here is the way to do it other wise follow the instrcuctions in the download page you just uded to download the JDK:
XP
go to the control panel......>click on system...> click on Advanced in the upper left corner....>then click on Environment variables button at the end of the wiondow....then in the second area of the new window look for path and click on it and in the variable value do not change or deletre any thing just go to the end of that whole line and type in : ;C:\name of the folder you just downloaded to the C drive\bin
do forget that there is a semicolon befor the C:\ so pay attention to it
and then click apply and restart your computer and now you should have it working so go to the MS-DOS and type in javac MyClass.java
of course it will give you an error so if the erroe is like
: could not fine file MyClass...congratulation you have it running
or id the error is like javac is not recognized.....there is an error and it might be that you did not put the name of the flder correctly so go again to the C disk and right click the foolder jdk..... and choose rename but do not rename it instesd copy that name and the click enter to return it back to its original name and then go to the same place in the path and paste that name where i said to be "the name of the folder you just downloaded and restart the computer again and that should work
i hope i did not make you confused and good luck if you have any problems plz post any question or e-mail me at QMAQMA@hotmail.com
Regards </div></span></font>
-
<font color='#000080'>ياجماعه..
هل تعتقدون إن باستطاعكم أو بستطاعتنا <img src="http://oasis.bindubai.com/emoticons/biggrin.gif" border="0" valign="absmiddle" alt=':D'> تعلم الجافا بانواعها بهاي الطريقه !! <img src="http://oasis.bindubai.com/emoticons/rock.gif" border="0" valign="absmiddle" alt='???'>
نحن ندرس الجافا أبلتس والأدفانس دايركت من المدرس ويااااااااااالله يالله إنقببظ شي...
يعني اللي أقصده إن لازم اللي يشرح الجافا يشرحه سماعي ونظري بعد <img src="http://oasis.bindubai.com/emoticons/biggrin.gif" border="0" valign="absmiddle" alt=':D'>
ها..بكم الساعه ؟ <img src="http://oasis.bindubai.com/emoticons/tounge.gif" border="0" valign="absmiddle" alt=':p'></font>
-
<font color='#FF0000'>Well .... I even can do that if you want we can open a room in Paltalk and we can talk and type at the same time , but by eyes....i do not think so man it is a littel sensetive ....not everybody want to show his face on the World Wide Web
and one more thing ... i would love to give lectures in Java to students ...that is why i am lookking for a job in one of the universities in the gulf to teach java because i am asked by the university which i study in to do 9 months of training so hope i can get one or if you can help me to get one that will be great.
Regards</font>
-
<font color='#000000'><div align="left">el salaam 3aleekom
i would like to know what is the purpose of using the static option ? what does it do exactly
and
whats the difference between toString and toUniversalString?
we havent taken this class ---> java.io... so can u plz put examples using javax.swing?
and if its not too much i would like to ask about any tutorial sites where i can learn more codes..:)
i may post a question and ask u for the solution plz? is that ok with u <img src="http://oasis.bindubai.com/emoticons/lookaround.gif" border="0" valign="absmiddle" alt=':look:'>
thanx</div></font>
-
<font color='#FF0000'><div align="left">[Sallam .. Yeah i am kindaa late in answering this question, but you guys know theses are the besiest days in any student'sife....well yeah let's talk again about
static key word ... it means that any static variable is only in one copy...so let's say that there is a variable static int counter =1;
and there are 3 methods in the same calss one called public void add()
which adds one to the counter so now the counter is 2 ... right
and another method called multiply which multiply the counter by 5 so the counter is equal tp 10 now if the counter was not static the
multiply result would be 5 because we will take the intitaial value which is 1 but being static means that each time we modify its intial value is rewritten by the new value
and another thing for a static variable or method ... you can call them without having to istantiate the calss they reside in lets say a calss MyClass has the method static print
and another class called TestMyClass wants to call the print method in the MyClass so you have two ways to call it 1- by instantiating the MyClass like this
MyClass obj = new MyClass();
and then call the method like this
obj.print();
or
2- by Just doing this
MyCalss.print();
so we did not have to istantiate the MyClass class
Ok for the java.io package
it is the Input/Output package having clsses that you can to use to read the user input or to read as much data as you want from a file in your computer or Even creating a file using a java program or to read data coming from another compuiter through the netwirk by using Socket .... Yes it is the hardest task i have seen in Java untill now ... but the coolest stuff at the same time it is really amazing as weel as Network Programming
Sure ... post any problem or send it by e-mail and i will be more than happy to lookat it and try to solve it insha'ALLAH
Good Luck and feel free to ask for any help ..... </div></font>
-
<font color='#000000'>ممكن مساعدة
ابغي شرح عن
abstract,interface,static
والبقية تأتي
والسموحة</font>
-
<font color='#FF0000'><div align="left">sure man
abstract class is ageneric class that can be extended by other classes thst share some methods and behaviors. An abstract class has both concrete and abstract methods . the abstract methods are just defined by their names ; signature and there is nothing about their behaviors. so when a class extend that abstract class it defines its abstract methods as it wants. say for example we have a geometric class which have two methods ; get area and getvolume....as we all know that a circle and a rectangle are both geometric objects so both should extend that class but each one has a different way to calculate the area and the volume soo there we go.for the interface you implement the interface and you have to implement all its abstract methods..interfaces are more generic and all have constant variables and abstract methods ...for both those kind of classes we cannot instantiate them...we either extend them.....abstract ones;or implement them;;; interfaces
and man for the static key word i recommond reading the previous posts of mine and other members in this subjects
SALLAM NOW</div></font>
-
<font color='#000000'>السلام عليكم....
اول شي... تشـــــــــــــــــــــكر .. اخوي صقر البوادي ع الخدمه الطيبه...
احنا المفروض الكورس اللي طاف... نحل واجباتنا ع الجافا.. بس لانه اغلبيتنا ما كنا انعرفها اتوهقنا وايد... وللحين احنا ما اتعلمنا شي...
وصراحه.. انا للحين ما قريت الشرح اللي كتبته... بس حبيت اسأل .. لو تابعنت الشرح... تتوقع اني بتعلم ولا لا.. كمبتدئه...؟؟
وسلمت... <img src="http://oasis.bindubai.com/emoticons/smile.gif" border="0" valign="absmiddle" alt=':)'></font>
-
<font color='#FF0000'>Sallam Sorry for being late in respondinn..always busy with school
Well that's realy depends on you and youe willingness to read and learn..but let me tell you something...i only went over the basic things and then started to answer questions being posted by advanced people ,,though you can find the fundamental steps in the earliest posts in this topic and i think you have a good background to catch up ...if you have any problem just post your question and i will be glad to answer
Sallam now...</font>