Main method question in java, please help
Guys I have looked all over the internet, and cannot understand any of these questions: I would really appreciate any help on them. The first, and most important thing I would like to know is, what is static: what is a static int, or a static main method? Why is this necessary, and what does it do? Could you please provide an example? Also, why is String[] args necessary within the parameters of the main method? Is this so that it can execute it? Last thing is: objects. Where can I learn about them? I know they are made with the new operator, but don't understand their use? Could you explain why they are useful? Can you give them values? and how do they relate to the dot operator? After these are answered, I will be so happy because I will feel like I actually know a little bit. Right now, I'm just confused... Thank you so, so much in advance!
The first, and most important thing I would like to know is, what is static'static' means that the item concerned is associated with the class itself rather than an instance: so, it is accessible to all instances.
Could you please provide an example?
public static void main(String[] args)is an example, but you knew that. I don't really understand the question.
Also, why is String[] args necessary within the parameters of the main method?'args' receives the arguments you type on the command line after the class name or jar name, depending on how you invoke the application.
This is all covered in the documentation, which you should read before asking further questions.
Last thing is: objects. Where can I learn about them?If you don't know about objects you're not going to learn about them by asking questions on a forum. It's far too large a topic. Get yourself a book.
Similar Messages
-
Fundamental questions in Java, please help to answer.
I am a beginner of a Java Programming. Although I had few programming experiences on Java. But there are few conceptal questions. Hope every experts can help to explain more to me.
1. How <b>Encapsulation</b> works in Java? Why is it needed? What benefits can be given from encapsulation? Can give some examples for me to know more?
2. How <b>Overloading</b> works in Java? Why is it needed? What benefits can be given from it in the extensibility of programs? Can give some examples for me to know more?
3. How <b>inheritance</b> works in Java? What benefits can be given from inheritance? Can give further explanation, such as class hierarchy for me to know more?
4. What is <i>object class</i> and <i>object distances</i> ? What is their differences?
5. What is <b>Reusability</b>? What benefits can it gives? Why it is needed? Can give me further examples?
Thanks for help very muchMaybe I'm not getting this, but you want one of us to give you a nice short answer convenient enough for you to copy down, right? Well, there aren't many people here that are willing to do that. There are many people who won't even bother answering homework questions. I don't mind, but you need to show us some work you've done, like the previous poster said. The effort has to come from you, not us. If you are learning Java, you must put some effort into it.
How can you get an answer out of us?
Example: I understand that inheritance is ..............., but I'm not sure about this part.............. Can anyone provide some clarification please?
Anyway, this question has been crossposted on at least 5 forums already, which I'm sure is one of the reasons people aren't bothering with this question. Please DO NOT CROSSPOST, it's considered poor forum etiquette.
Please don't take anything that I said negatively, but you have to understand that we are taking our time to respond to your queries, and asking us to provide short answers without doing any work on your part, and crossposting is not going to get you answers out of us.
Cheers -
Pascal to Java Please help me!
I am truobled in creating a validation method for the user loging in....
As I am perfect at Pascal can anyone translate the following pascla code to Java Please help me with this.
PROGRAM USERLOGIN;
TYPE
USER_TYPE = RECORD
USERNAME : STRING[15];
PASSWORD : STRING[15];
END;
USFILE = FILE OF USER_TYPE;
VAR
USER: USER_TYPE;
CKUSER: USER_TYPE;
RECFILE : USFILE;
I,J : INTEGER;
BEGIN
WRITE('ENTER USERNAME:');READLN(CKUSER.USERNAME);
WRITE('ENTER PASSWORD:');READLN(CKUSER.PASSWORD);
FILESPEC :='USERFILE.USR';
ASSIGN(RECFILE, FILESPEC);
RESET(RECFILE);
WHILE NOT EOF(RECFILE) DO
BEGIN
READ(RECFILE, USER);
IF CKUSER.USERNAME = USER.USERNAME AND CKUSER.PASSWORD = USER.PASSWORD THEN
LOGIN
ELSE
WRITE('USER NOT FOUND');
END;
END.Thank youDon't bother:
http://forum.java.sun.com/thread.jsp?forum=54&thread=539277 -
Dear Apple Support ,
This is ***Abdurrahman*** ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .
Best wishes,The people on these boards aren't Apple Support and can't do that for you. You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
(102461) -
i have a ipod touch 2nd generation 8gb 4.2.1 im new to itunes i made a itunes account but it says i need a payment method is there anyway i can use my paypal if not is there a way to not have to use a payment method for itunes store please help ty
Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
Using those instructions you may also be able to select PayPal if that is allowed in your country. -
Support ,
This is Thamer mohammad
,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .
Best wishesThese boards aren't Apple Support; nobody here can reset the questions. Click here, phone Apple, and ask for the Account Security team, or fill out and submit this form.
(90021) -
I forgot my security questions can you please help me?
i forgot my security question can you please help me?
See Here > Apple ID: Contacting Apple for help with Apple ID account security
Ask to speak with the Account Security Team...
Or Email Here > Apple Support iTunes Store Contact
More Info > Apple ID: All about Apple ID security questions
Note:
You can only set up and/or change a Rescue Email BEFORE you forget the questions/answers. -
Dear Apple Support , I can't remember my security question answers , so Please help me to Create new Security Question for my Account . Best wishes
<Email Edited by Host>Welcome to the user to User Technical Support Forum provided by Apple.
Please do not post personal information on a Public Forum.
I have requested the Hosts remove it for you
For your issue...
See Here > Apple ID: Contacting Apple for help with Apple ID account security
Ask to speak with the Account Security Team...
Or Email Here > Apple Support iTunes Store Contact
More Info > Apple ID: All about Apple ID security questions
Note:
You can only set up and/or change a Rescue Email Before you forget the questions/answers. -
Dear Apple Support ,
This is amany alnajjar ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .The Best Alternatives for Security Questions and Rescue Mail
a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
b. Call Apple Support in your country: Customer Service: Contact Apple support.
c. Rescue email address and how to reset Apple ID security questions. -
Dear Apple Support , This is FAHAD ALGORWAN ,I can't remember my security
> question answers , so Please help me to Create new Security QuPlease do not make multiple posts. One is enough. These are user forums, so you are not speaking to Apple here.
The Best Alternatives for Security Questions and Rescue Mail
a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
b. Call Apple Support in your country: Customer Service: Contact Apple support.
c. Rescue email address and how to reset Apple ID security questions. -
rt ,
This is ***majed*** ,I can't remember my security question answers , so Please help me to Create new Security Question for my Account .
Best wishes,If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then the steps half-way down this page give you a reset link on your account : http://support.apple.com/kb/HT5312
If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact iTunes Support / Apple in your country to get the questions reset.
Contacting Apple about account security : http://support.apple.com/kb/HT5699
When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 link above to add a rescue email address for potential future use -
I can't remember my security question answers , so please help me to Create new Security Question for my Account : **********
, Best wishes
<Personal Information Edited by Host>We are fellow users here on these user-to-user forums, you're not talking to iTunes Support nor Apple - I've asked the hosts to remove your email address from your post (it's not a good idea to post personal info on any public forum).
If you have a rescue email address (which is not the same thing as an alternate email address) on your account then the steps half-way down this page will give you a reset link on your account : http://support.apple.com/kb/HT5312
If you don't have a rescue email address (you won't be able to add one until you can answer your questions) then you will need to contact Support in your country to get the questions reset.
Contacting Apple about account security : http://support.apple.com/kb/HT5699
When they've been reset (and if you don't already have a rescue email address) you can then use the steps half-way down the HT5312 link above to add a rescue email address for potential future use -
Java programming language main method question?
Hello everyone I am quite new to the Java programming language and I have a question here concerning my main method. As you can see I am calling 4 others methods with my main method. What does the null mean after I call the method? I really don't understand is significance, what else could go there besides null?
public static void main(String[] args)
int cansPerPack = 6;
System.out.println(cansPerPack);
int cansPerCrate = 4* cansPerPack;
System.out.println(cansPerCrate);
have_fun(null);
user_input(null);
more_java(null);
string_work(null);
}Edited by: phantomswordsmen on Jul 25, 2010 4:29 PMphantomswordsmen wrote:
..As you can see I am calling 4 others methods with my main method. 'Your' main method? Your questions indicate that you did not write the code, who did?
..What does the null mean after I call the method?.. 'null' is being passed as an argument to the method, so there is no 'after the method' about it.
..I really don't understand is significance, what else could go there besides null? That would depend on the method signatures that are not shown in the code snippet posted. This is one of many reasons that I recommend people to post an SSCCE *(<- link).*
BTW - method names like have_fun() do not follow the common nomenclature, and are not good code for a newbie to study. The code should be put to the pointy end of your sword. -
Why the same name of process comes out in AIX , in java. please help me.
Hello.
I have two questions related to Jvm.
I've developed Job scheduler program which is doing somthing as the DB schedule is set in the way of Multi
thread. Currently , I'm in the process of testing this one. It is good , if in the normal case. However, When
doing Shell, if the application have so a lot to do the Shell, it has a little problem.
My developing environment is
OS : AIX 5.3
JRE : IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr7-20091214_49398
(JIT enabled, AOT enabled)
nofiles(descriptors) 2000
maxuproc 4096 Maximum number of PROCESSES allowed
per user True
In order to execute Shell in My Scheduler program , I tested Runtimeexec() or ProcessBuilder.
The result of mine in the test , when the executed Shell got over 300 is
1. The jvm processes that I execute at the first time are shown up , after Shell go to the finish, the
processes are all in the disappearance again , and at last The processes that I executed at the first time are
remaining. It's like the process is duplicated process in the maximum of 70.
When I do shell about 200 to be executed simultaneously, Duplicated jvm about 3 appeared momentarily, then
disappeared, and also under 120, No duplicated case is found when under 120.
ps -ef result is below , when shell is excuted
UID PID PPID C STIME TTY TIME CMD
jslee 626906 1 0 11, May - 2:20 java -
DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
jslee 1421522 626906 0
19:36:16 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -Dfile.encoding=euc-kr jobserver.JobServerMain
....Skip.....
jslee 4374620 626906 0 19:34:06 - 0:00 java -DD2_JC_HOME=/source/jslee/JOB -
Dfile.encoding=euc-kr jobserver.JobServerMain
(the process list about 60)
*the first question : Why a lot of duplicated jvm are shown up when in alot of shell to be executed ?
*the second question : As you can see above , How can I solve out the problem.
*Is there some option that I can set up when starting Jvm?
---Next question---
My developing environment is
OS : SunOS 5.8
JRE : Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Server
VM (build 16.0-b13, mixed mode)
nofiles(descriptors) 256
As shown obove , the value of descriptors is 256 .
My scheduler program executed 300 shell at the same time, in result my program was abnormalily
terminated after doing shell about 180.
the Exception info is
java.io.IOException: Cannot run program "sh": error=24, exceeding the number of opened files
at
java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at
java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
or
java.net.SocketException: exceeding the number of opened files at java.net.PlainSocketImpl.socketAccept
(Native Method)
또는
java.io.IOException: exceeding the number of opened files at
java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(Unknown
Source)
at java.io.File.createTempFile(Unknown Source)
*question : If I continuously request to open a file that go over system limit, is it possible for JVM to be
terminated?
*question : Is there a method that obtains state of System limit in the java library.
*question : what is the best solution to cope with ?
Please help me
=struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="registrationForm" type="ndlinh.struts.lab.RegistrationForm" />
</form-beans>
<action-mappings>
<action path="/register"
type="ndlinh.struts.lab.RegistrationAction" // action class
name="registrationForm" // form bean name
validate="false"
scope="request"
input="registration.jsp" >
<forward name="success" path="/jsp/success.jsp" />
<forward name="failure" path="/jsp/failure.jsp" />
</action>
</action-mappings>
</struts-config>HTH -
No one has answer of my question?? please help!!
hi gurus,
i am trying to test sun provided demo programs for testing JAVA Mail API
i am getting these errors please help me out ......
thanks in advance
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25
DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 30687-1)
DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25
DEBUG SMTP SENT: EHLO pankaj01
DEBUG SMTP RCVD: 250-my.test-inc.com says hello
DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:<[email protected]>
DEBUG SMTP RCVD: 250-SIZE 0
DEBUG SMTP SENT: RCPT TO:<[email protected]>
DEBUG SMTP RCVD: 250-8BITMIME
Verified Addresses
[email protected]
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 250-DSN
DEBUG SMTP SENT: QUIT
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 250-DSN
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
javax.mail.MessagingException(java.lang.String, java.lang.Exception)
javax.mail.SendFailedException(java.lang.String, java.lang.Exception, javax.mail.Address [], javax.mail.Address [], javax.mail.Address [])
void javax.mail.Transport.send0(javax.mail.Message, javax.mail.Address [])
void javax.mail.Transport.send(javax.mail.Message)
void adt.com.ocs.ldap.ui.SendFile.main(java.lang.String [])this is the output I'm getting through your program
DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]
POP3: connecting to host "216.147.121.178", port 110
S: +OK crescotec.com POP3 Server (Version 1.020h) ready.
C: USER ritesh
S: +OK please send PASS command
C: PASS ritesh
S: +OK 0 messages ready for ritesh in /home/cresco12/crescotec-mail/ritesh
from: [email protected]
to: [email protected]
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG: SMTPTransport trying to connect to host "216.147.121.178", port 25
DEBUG SMTP RCVD: 220 yourserver.net ESMTP Sendmail 8.10.2/8.10.2; Wed, 25 Jul 2001 16:22:03 -0400
DEBUG: SMTPTransport connected to host "216.147.121.178", port: 25
DEBUG SMTP SENT: EHLO riteshnew
DEBUG SMTP RCVD: 250-yourserver.net Hello 66-2-186-193.customer.algx.net [66.2.186.193], pleased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250 HELP
DEBUG SMTP Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP Found extension "8BITMIME", arg ""
DEBUG SMTP Found extension "SIZE", arg ""
DEBUG SMTP Found extension "DSN", arg ""
DEBUG SMTP Found extension "ONEX", arg ""
DEBUG SMTP Found extension "ETRN", arg ""
DEBUG SMTP Found extension "XUSR", arg ""
DEBUG SMTP Found extension "HELP", arg ""
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG: SMTPTransport trying to connect to host "216.147.121.178", port 25
DEBUG SMTP RCVD: 220 yourserver.net ESMTP Sendmail 8.10.2/8.10.2; Wed, 25 Jul 2001 16:22:03 -0400
DEBUG: SMTPTransport connected to host "216.147.121.178", port: 25
DEBUG SMTP SENT: EHLO riteshnew
DEBUG SMTP RCVD: 250-yourserver.net Hello 66-2-186-193.customer.algx.net [66.2.186.193], pleased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250 HELP
DEBUG SMTP Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP Found extension "8BITMIME", arg ""
DEBUG SMTP Found extension "SIZE", arg ""
DEBUG SMTP Found extension "DSN", arg ""
DEBUG SMTP Found extension "ONEX", arg ""
DEBUG SMTP Found extension "ETRN", arg ""
DEBUG SMTP Found extension "XUSR", arg ""
DEBUG SMTP Found extension "HELP", arg ""
DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:<[email protected]>
DEBUG SMTP RCVD: 250 2.1.0 <[email protected]>... Sender ok
DEBUG SMTP SENT: RCPT TO:<[email protected]>
DEBUG SMTP RCVD: 250 2.1.5 <[email protected]>... Recipient ok
Verified Addresses
[email protected]
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 354 Enter mail, end with "." on a line by itself
DEBUG SMTP SENT:
DEBUG SMTP RCVD: 250 2.0.0 f6PKM4A18446 Message accepted for delivery
DEBUG SMTP SENT: QUIT
here is the code that I modified the I had just deleted my user name and password due to some confidentially problem at the organization. I think you can understand it here is the code the location where I had written
xxxxxxx is the user name and ****** is a password.
/**The Code*******************************/
// Copyright (c) 2000 vitalspring
package package1;
* A Class class.
* <P>
* @author developer1
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailer
public static void main (String args[]) throws Exception
String smtpHost = "216.147.121.178";
//String smtpHost = "smtp.mail.yahoo.com";
String popHost = "216.147.121.178";
// I had replaced my.test-inc.com to 216.147.121.178 the ip address that you can
// get by typing the command ping and the server-name
//String popHost = "pop.mail.yahoo.com";
// String from = "[email protected]";
// change this string to my username i.e the account that I have on the above hosts
String from = "[email protected]" ;
String to = "[email protected]";
// String username = "pankaj";
String username = "xxxxx" ;
// String password = "pjha";
String password = "*****" ;
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", smtpHost);
// props.put("mail.smtp.auth", "true");
// Get session
// I had just commented out this for testing
// Session session = Session.getInstance(props, new MyAthenticator());
Session session =Session.getInstance (props,null);
session.setDebug(true);
// Pop Authenticate yourself
Store store = session.getStore("pop3");
store.connect(popHost, username, password);
// Define message
MimeMessage message = new MimeMessage(session);
InternetAddress addrTO=new InternetAddress(to);
InternetAddress addrFROM=new InternetAddress(from);
message.setFrom(addrFROM);
System.out.println("from: "+addrFROM.getAddress());
System.out.println("to: "+addrTO.getAddress());
message.addRecipient(Message.RecipientType.TO,addrTO);
message.setSubject("Hello JavaMail");
message.setText("Welcome to Yahoo's JavaMail");
Transport transport = session.getTransport("smtp");
transport.connect(smtpHost, username, password);
// Send message
transport.send(message);
class MyAthenticator extends Authenticator
public PasswordAuthentication getPasswordAuthentication()
return new PasswordAuthentication("pankaj","pjha");
You must have received a mail from [email protected] at your account that you have specified here. I had also commented the authenticator method...
Sorry your account at this server is not existing since its returned back to me . Anyway ...
have a nice time
Maybe you are looking for
-
Loading a library in my own class...
Hello, I'm having some problems with loading my own library into a different class then the main, but I'm keep getting this error message: run: Exception in thread "main" java.lang.UnsatisfiedLinkError: cembedjava.CFunctions.nativePrint()V at
-
Monitoring /var/adm/messages
Hello to all, we are developing system for monitoring of the servers trough reading of the /var/adm/messages file. Since there are numerous messages in this file we are wondering what regular expressions to use in order to extract serious/critical al
-
Filtering records using a start routine inside the update rules for a dmart
Hi I am using a start routine inside the update rules. I want to filter out all records that have 0 in all three fields. My problem is that it not only filters these records, but also filter records with negative values, which I do not want. Only 1 f
-
Hello, I would know: It would be possible to implement in a Catalyst 6500, when a packet reaches with destination IP address 10.2.2.20 is redirected to IP 10.2.2.58 (are servers) Is that possible making some kind of NAT ? Regards, S.
-
Tracking Video Clip to JPG BG Image
I am creating an animation scene with a JPG background image (replicating a website) in which the camera moves throughout the webpage (or jpeg). I also have smaller video clips over the jpg that play and stop and I would like to track these to the j