Aman Kulkarni

Greenhorn
+ Follow
since Jan 21, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Aman Kulkarni

Bear Bibeault wrote:"user-friendly" is not applicable. A language cannot be 'user-friendly" or not. The programs you create with a language can be user-friendly or not. And that all depends upon how you use the language, not on the language itself.

I assume you meant "programmer-friendly"?




YES I MEANT EXACTLY THE SAME !!!
12 years ago
An user friendly programming language is one that must be easily usable to people/programmers those who wish to do. Does Java actually do the same ?
12 years ago

Jeff Verdegan wrote:

Aman Kulkarni wrote:

John Jai wrote:I don't quite understand the question - but using javac you compile a .java file that can contain many classes within it. The file name should be identical with the public class declared.

So I can save the below code in some file say "Hai.java" and when I compile the java file I get three class files - SomeOther, Outer$Inner and Outer



So in the above case...which class name shall I use in order to get the output ???



There's no code there that produces any output, so the answer to your question is "none."

When you ask "which class name shall I use", are talking about which class name to provide on the command line when you launch the JVM? If so, then the answer is always, "The class whose main method you want to execute as your program's entry point."




That's i wanted to know...
12 years ago

Stephan van Hulst wrote:That seems non-intuitive. Throwing and handling exceptions are polar opposites. When you use the throws keyword on a method signature, it doesn't mean the method handles the exception. It means it may throw that exception under certain circumstances, and code calling the method should deal with the possibility that that particular exception may be thrown.

It doesn't make sense on the class level. So no, you can't do this.




Ok ! thanks a lot !!! You see I am still kinda newbie...So please bear with some stupid questions
12 years ago

John Jai wrote:I don't quite understand the question - but using javac you compile a .java file that can contain many classes within it. The file name should be identical with the public class declared.

So I can save the below code in some file say "Hai.java" and when I compile the java file I get three class files - SomeOther, Outer$Inner and Outer



So in the above case...which class name shall I use in order to get the output ???
12 years ago

Bear Bibeault wrote:

Aman Kulkarni wrote:So why don't you tell me the actual parameter of selection of the class name


Getting snarky with people who are volunteering their time to try and help you is not a strategy for success. I'd strongly advise a reconsideration of your approach.



Ok thanks for your opinion...
12 years ago

Henry Wong wrote:

Aman Kulkarni wrote:

Stephan van Hulst wrote:If you did that, what should it mean?




I haven't tried it yet due to some java unavailability...I am for holidays and the only thing I have is the internet connection...So thought of asking it !




You don't need availability to java to answer the question. Let's assume that it was allowed, what would you expect it to do... After all, you asked why we can't use a feature? You should have an idea of what this feature will do right?

Henry



If we use it in the class itself...All the exceptions of the entire class will be handled....I am asking is it allowed ??
12 years ago

Stephan van Hulst wrote:If you did that, what should it mean?




I haven't tried it yet due to some java unavailability...I am for holidays and the only thing I have is the internet connection...So thought of asking it !
12 years ago
Why can't we use the "throws Exception" for a class ?

Like "class Demo throws Exception" ???

Hope it is not too silly !
12 years ago

Jeff Verdegan wrote:

Aman Kulkarni wrote:Keeping the class name and name of the file same is an unwritten rule...some follow...while some don't...



Yes, I know that, but it has nothing to do with the main method.



So why don't you tell me the actual parameter of selection of the class name
12 years ago
Keeping the class name and name of the file same is an unwritten rule...some follow...while some don't...
12 years ago
I used the same program and it executed without any hassles...I accept the class name and the indentation mistake....and the String args[] is the way we were taught java...it may be considered as my ignorance but not arrogance
12 years ago
public class PhaseOMatic
{
public static void main(String args[])
{
String[] wordListOne={"24/7","multi-tier","30,000

foot","B-to-B","win-win","frontend","web-based","pervasive","smart","six-sigma","critical-path","dynamic"};
String[]

wordListTwo={"empowered","sticky","value-added","oriented","centric","distributed","clustered","branded","outside-the-box","

positioned","networked","focused","leveraged","aligned","targeted","shared","cooperative","accelerated"};
String[] wordListThree={"process","tipping-point","solution","archtecture","core

computing","strategy","mindshare","portal","space","vision","paradigm","mission"};
int oneLength=wordListOne.length;
int twoLength=wordListTwo.length;
int threeLength=wordListThree.length;
int rand1=(int)(Math.random()*oneLength);
int rand2=(int)(Math.random()*twoLength);
int rand3=(int)(Math.random()*threeLength);
String phrase=wordListOne[rand1]+" "+wordListTwo[rand2]+" "+wordListThree[rand3];
System.out.println("What we need is a "+phrase);

}
}



This program is 100% error-free and will give correct output...
12 years ago
public class PhaseOMatic
{
public static void main(String args[])
{
String[] wordListOne={"24/7","multi-tier","30,000

foot","B-to-B","win-win","frontend","web-based","pervasive","smart","six-sigma","critical-path","dynamic"};
String[]

wordListTwo={"empowered","sticky","value-added","oriented","centric","distributed","clustered","branded","outside-the-box","

positioned","networked","focused","leveraged","aligned","targeted","shared","cooperative","accelerated"};
String[] wordListThree={"process","tipping-point","solution","archtecture","core

computing","strategy","mindshare","portal","space","vision","paradigm","mission"};
int oneLength=wordListOne.length;
int twoLength=wordListTwo.length;
int threeLength=wordListThree.length;
int rand1=(int)(Math.random()*oneLength);
int rand2=(int)(Math.random()*twoLength);
int rand3=(int)(Math.random()*threeLength);
String phrase=wordListOne[rand1]+" "+wordListTwo[rand2]+" "+wordListThree[rand3];
System.out.println("What we need is a "+phrase);

}
}



This program is 100% error-free and will give correct output...
12 years ago
Hi,
The class name is decided by the compiler on the basis of where the main method [public static void main(String args[])] is declared.

For example:
//File name: Demo.java
class Test
{
public static void main(String args[])
{
System.out.println("Statement in main method");
}
}
class Test1
{
public void check()
{
System.out.println("Statement in diff method");
}

}


Save this file and first compile as javac Demo.java and execute it as java Test

So it is recommended that one must save the file with the name similar to the class containing the main method. One can do the same using a public class.

Hope it will be helpful.
12 years ago