Some basic java Questions

class overload
void test (long a)
System.out.print("\n\t\t Inside Integer..."+a);
class usetest
public static void main(String args[])
overload ob=new overload();
double i=88;
int j=54;
//ob.test(i); this do not work
ob.test(j); // works
The one that do not work when typecasted works why? When method having same parameter is not present what java compiler do?

The compiler will automatically perform a "widening" cast for you, i.e.
a cast from one type to another where no precision is lost. If you supply
an int and a long is wanted, the int will be cast to a long type.
Not so from double to long because that isn't a widening cast, it's a
"narrowing" cast because bits might get lost after casting. You have
to cast that double to a long explicitly, thereby telling the compiler that
you know what you're doing.
kind regards,
Jos

Similar Messages

  • Making some basic Java games

    Can anyone help on how to make some basic java games for my website if you could that would be helpful
    thanks,
    Louie

    Well, first of all you program the Framework, add Graphics / sounds / Data , then you put it in your HP - There you are!

  • 4 basic java questions..

    ok so I already learned Java last year (in grade 11), but my teacher didn't really teach anything, we learnt everything by ourselves from the API... so theres a lot of things I actually don't understand, but for now I want to ask 4 basic questions:
    1. What does static mean?
    2. Why would u "final" a constant variable? ie. If you have a variable called SIZE which is set to 5, so if u want it to be a constant, just never change its value. But what does the keyword final do to it?
    3. What's super? I see it sometimes, and my teacher showed us in the applet exampls to use super.paint(g) or somethign like that for the paint method, but I never use that because I noticed it works fine without it..
    4. Whats a question mark? I saw a game that was made in java and it had a lot of places where it had a question mark , which was part of the syntax. For example,
    int j1 = i != 0 ? i - 1 : 199;
    OR
    JUMPVEL = (fSuperSlime) ? 65 : 31;
    I really don't understand these lines...
    feel free to answer any of these questions...

    wow cool...thanks.. that question mark thing is nice
    saves a few lines..
    now, about super, so u mean u can access the parent
    class's variables?Variables, methods, constructors, if the access level is such that it's allowed.
    This will be covered in any tutorial or text though.
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com. A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoratative than this.

  • Plese help! Stuck on some basic Java homework...

    I am taking this introduction to java class and we were given 3 homework assignments and I am really stuck on 2 of them.
    One of the assignments asks to make a index.html page that will connect to a mysql database for coffee/suppliers.
    The first part says:
    Create the index.html to create the following web page. After a user selects
    Espresso and 5 pounds, and clicks �Submit Order� button, he/she is going to see the
    following URL:
    http://localhost:8080/hmwk09/coffee_processing.jsp?name=Espresso&pounds=5&Submit=Submit+Order
    (which I sort of completed physically with dreamweaver. im not sure if i need to embed some java into that page.)
    The second part which I am really stuck on says:
    Create the coffee_processing.jsp that queries coffees and suppliers table (you created in homework 08) to display the following page:
    This part is where it queries the mysql database that I did. The page is basically supposed to look like this (in a webpage format):
    Here is the information about your order:
    | Name | Supplier | Price |
    | Espresso | The High Ground| 9.99 |
    Number of Pounds: 5
    Total Price: $49.95
    (I really confused on what I need to do to create a jsp to do this. Thanks so much in advance!)

    well, first create a jsp page that defines how the page will look. Then make use of a <jsp:useBean..> in combination with <jsp:getProperty....>
    and <jsp:setProperty....> to access a bean that does the database fetching.

  • Basic Java questions

    Hi.. I just joined a new company, they have developed a Java software. They have a few Sun Java Server with Tomcat, Silversteam, oracle. And their application are run on Java Web Start.
    I want to learn more about Java in order to manage the server, but I have very little knowledge of it
    1)What is the difference between Java Run Environment or Java Web Start??
    2)When I can't access my HSBC internet banking, they told me I need to download the new Java? Is that JRE? What does it do to my computer?
    3)What is the difference btw the Tomcat and Silversteam ?? Can Tomcat be installed in W2K server?
    4)We can create a Jar file from the Jar class? What is Jar Class then? How to create a sample program that can be start from JWS??

    Hi.. I just joined a new company, they have developed
    a Java software. They have a few Sun Java Server with
    Tomcat, Silversteam, oracle. And their application
    are run on Java Web Start.
    I want to learn more about Java in order to manage the
    server, but I have very little knowledge of it
    1)What is the difference between Java Run Environment
    or Java Web Start?? Java Web Start is a tool that lets you manage start remote Java apps.
    The Java Runtime Environment (JRE) is the interpreter through which all Java code is executed.
    2)When I can't access my HSBC internet banking, they
    told me I need to download the new Java? Is that JRE?
    What does it do to my computer?You have to download the JRE or the Java plug-in for your browser. It does nothing special to your computer - it's just another application or plugin.
    >
    3)What is the difference btw the Tomcat and
    Silversteam ?? Can Tomcat be installed in W2K server?
    I don't know Silverstram. Tomcat is a web server written in Java.
    It can run on any Java-enabled platform (i.e. any platform having the JRE installed).
    4)We can create a Jar file from the Jar class? You can create a Jar using the jar tool or any zipping program, Winzip etc...
    A Jar file is basically a zipped file.
    What is Jar Class then?Whatever a "Jar class" is (which I don't know) it has nothing to do with the Jar files.
    How to create a sample program
    that can be start from JWS??Create a remote application.
    You need to check some documentation and some good books.

  • Need to talk through some basic Java principles

    I know this is asking a lot, but I need to talk to someone about Java basics. I have an interview coming up. I am studying, but really need to talk through some things with someone who is familiar with Java programming. My email address is [email protected] If someone could send me a telephone number and perhaps spend 30 minutes on the phone, I would be very greatful. Thanks!

    I don't know if there are any forums where they help you fake your way through interviews.

  • Simple basic java question

    public static void main(String[] args)
    ..anyone know the statement as above could be start at begining , so what is the (String[ ] args) mean in java ?
    in my ideas of this statement is
    publc : indicates the statemean can be used as all class , this is open for public use
    static mean the main method can used as class method
    void indicate that the statement return nothing
    main indicate any class should be run this first.
    so my question what is the function of (String [ ] args) ? // one string array call args ?

    String[] args is indeed an array of Strings called args. The reason it's there is to collect any arguments passed to your code when you start it.
    eg. if you have a class called TestClass and you called it from the command line like this:
    java TestClass exam tomorrow oh shite
    .......then the args array would hold the four Strings:
    exam
    tomorrow
    oh
    shite

  • Some basic NW questions?

    Hi All,
             I have a few elementary doubts in SAP NW could you please help me solve it?
    1) Where is SAP NW installed? Is it installed on WEB AS which inturn is on Application layer of R/3?
    2) Where is WEB AS installed?
    3) WHere are all the modules SD, MM, FI/CO installed?
    4) When we buy Netweaver do we get all the components like MI, XI, EP MDM etc along with it?
    5) If yes to the above, then do we have to install them or they come ready to use?
    6) Could you tell me why we have common login for SD, MM, Fi/co etc modules but different logins for EP, XI, MI etc?
    Regards,
    Ashish

    Hi Ashish
    There are numerous documents from where you can fined all your answers.But i will tell you briefly :
    Ans1: NW is basically an oceshtra of various components.There is a base WEB AS on top of which all other components like EP,XI,BI,MDM etc sits.There are different combinations of OS and database on which you can install NW.
    WEB AS is basically the foundation on which all your NW components sits.
    Ans2: WEB AS (Web application Server) consists of two types of engine.Dual stack (having both java as well as abap engine) and single stack(having java engine).As java is mentioned you need to have a jdk installed on your system
    Ans3:IF you have installed R/3 system say ECC 4.7 etc .All your SD,MM,FI/CO sits on top of your R/3
    Ans4:When you buy NW you have to all the softwares but license you have to procure for speacific components.For example: If you want to have XI then XI license has to be procured alond with you WebAS license.
    Ans5:Yes you need to install all of these components seperately.First is your WEbAS and on top of that you install the various components according to ur requirement.
    Ans6:I disagree with you here.In NW also you can have SSO (single sign on ) concept.That means a common login or single loggin for accessing all your systems.
    For more information log on to:
    http://help.sap.com
    http://service.sap.com
    Any querries related to NW feel free to ask

  • Some basic SCXI questions

    I have a SCXI system here with 3 modules.
    It was installed and set up by someone who no longer works here. I am pretty comfortable with cards, and scb-68's and what not.
    I do have a couple of questions about this SCXI though.
    1. When in MAX, if I start a NEW configuration, the SCXI is NOT there. But if I copy an existing config (save as) It is there. Out of curiosity, how do I "summon" the SCXI from a new config from scratch?
    2. MODULES:
    I have a PCI-MIO-16XE-50 as device 1.
    I have a SCXI 1000 as Chassis 1.
    In the SCXI I have 3/4 connectors, MD1-MD3.
    MD1 and MD3 have a 1303 terminal block.
    MD2 has a 1302 terminal block.
    In my traditional (LV 6.1) max configuration:
    MD1 is for all thermocouples.
    MD3 is for high speed dynamic signals
    here is where it gets interesting:
    MD2 is just pinned out directly to the 16XE-50? Why?
    My real question is why is MD2 setup to pin directly to the board, and from max assigned to 16XE-50 channels directly, while the other two modules are setup as "SCXI1102-DEV1_SC1_MD1"?
    What is the purpose of this? is there any advantages or drawbacks to using the SCXI platform VS. pining directly to the cardthru the SCXI module?
    Thanks.

    Hi,
    The SCXI is an extension for the conditioning of your signals. You need conditioning for some signals that are really low level and their measurement could be erroneous when connected directly to the PC. For example, the thermocouple measurements are low voltage values; therefore some signal conditioning is preferred before feeding these signals to the DAQ card. Your DAQ card (PCI-MIO-16XE-50) has a specific sample rate; and the sample rate of your system will depend on several factors. This knowledge base explains the relationship. More information about the modules you are using can be found in the modules' user manual.
    You could directly connect the conditioned signals to the DAQ card, but using the SCXI system you can measure more signals than what you could measure by connecting directly to the card. The outputs of your SCXI modules are connected to a multiplexer that passes those signals to the DAQ device. This article might be helpful in understanding how the signals are connected in the system. You don’t say what the modules in your chassis are; so I’m assuming that for the thermocouple measurements you are using the SCXI-1102 with the 1303 accessory. Please confirm that information. Another really good place to look at is the Getting Started with SCXI manual.
    Regarding to your module 2 that is directly pin out to the card, I’m assuming that you are using the SCXI-1180 module. That module is usually used to extend signal lines (from your DAQ card) that don’t require signal conditioning.  I can’t tell you why they are using those lines directly; it is really dependent in your specific application. My best assumption is that in those terminals you are measuring signals that don’t need to be conditioned before. I hope this is helpful, if no please give us more information about the specific modules that you are using.
    Ana P
    National Instruments
    Applications Engineer

  • Some basic JavaFX questions...

    1. Clearly you don't need an additional JavaFX plugin to run JavaFX in the browser so does this mean that a JAR containing all the JavaFX functionality is downloaded every time an application is run inside a browser? If so, how large is this JAR?
    2. Does anyone know if there are plans to integrate JavaFX in to the standard JRE (which would obviate the need to download it every time as in [1])?
    3. When does a JavaFX Script get compiled? That is, is it downloaded into the browser as text and then compiled in JIT fashion the first time it is accessed or is it always downloaded in a compiled state?
    Thanks,
    -Qu0ll

    I can answer question 3. The original javafx script really was a true script like javascript or php. It was compiled when your program run. The script language used in JavaFX 1.0 is compiled into class files stored in jars and then extracted and the class files are used to run the program. Just like a java program.
    Also, I think, but I am not sure though, that javafx depends on jars. When netbeans compiles a javafx program it compiles it with an option saying to run it on jre 1.5+ Obviously jre5 did not have fx yet, so I think javafx does depend on jar files.

  • Some Basic Logic Questions

    I used to use Cakewalk Sonar and I knew it really well. I just got my mac pro and logic 7.2 and I'm having trouble making sense of everything, including the manuals. Can anyone suggest some tips for me on the following simple items. I really thought they would be much more intuitive.
    1. Recording Audio with my Motu 896HD.
    2. Recording Midi with my M-Audio key Station
    3. Can I bus to a master fader? I don't see one in the mix board.
    4. I really need a good compressor. Can I rely on the Logic one or should I upgrade?
    5. rewiring Reason
    6. Can I build custom drum loops like I currently do in Reason?
    I just spent 3 hours tooling around and I'm a bit burnt out. I'm sure I'll get the hang of it but it's just overwhelming. I can't get used to the terms and the screens, etc.
    Your suggestions are appreciated.
    Mac Pro Mac OS X (10.4.8) Brand Spankin' New
    Mac Pro Mac OS X (10.4.8) Brand Spankin' New
    Mac Pro   Mac OS X (10.4.8)   Brand Spankin' New

    Yes Logic is extremely overwhelming at first, it was for me anyway. I have had it for a little over a year now and there is still a lot that I don't know, but I think I can answer the majority of your questions.
    I am not familiar with the MOTU 896HD, but I use a MOTU Traveler, so hopefully it is somewhat similar. It should be for the most part plug and play, so Logic should recognize it. When it comes to recording audio, open the mixer, and click tracks to view the audio channels. I've never used Sonar, but I'm guessing most things in this area are similar. First where a channel says something like "Input 1" you can click there and change the input source (this is the input on your MOTU), and then of course you engage for recording which I'm sure you know of this function.
    Recording midi with your m-audio is extremely self explanatory also, go to your mixer and select instruments, then load some type of soft synth in as an insert, then go to your arrange window (the main window that comes up as standard) and click the tiny little engage button next to that particular channel. If your m-audio is connected, it should automatically work just like that.
    Yes everything is in a master fader, if you click Outputs in the mixer, it should show your outputs, if nothing is there, then there is no output in the arrange, not to worry, click the Global button in the mixer window and then click to view the outputs, and there you go! There should be a fader for Outputs1-2, if you double click this, it will add it to your arrange window so you can automate and do stuff like that if you would like to.
    A lot of people rag on the Logic Compressor, but it does the job for me. If you search around these forums, there is a post about the Logic Compressor and EQs comparing them to other 3rd party productions.
    As for rewiring Reason, I have no experience with this whatsoever.
    Yes you can build custom drum loops, you can insert Ultrabeat into an instrument channel and use that. It is a extremely simplistic program if you need it to be, but it also allows you to change many parameters of the samples. It comes with tons of preset drum kits and banks, and of course you can use your own.
    Powerbook 15" 1.67 GHz PowerPC G4   Mac OS X (10.4.8)   User of Logic Pro 7.1.1

  • Anyone out there can answer some basic icloud questions?

    just getting introduced to icloud
    having a few minor issues
    want to put all music up not just purchashed
    what about audio books
    have 55 gb of icloud space
    have itunes match
    just need to learn how to put all the pieces together
    have ipad
    iphone
    pc laptop
    and pc work station

    iTunes Match will include all your music (some restrictions apply), not just purchased content, it doesn't include audio books.
    it doesn't use iCloud or your iCloud storage allowance, once you have subscribed it doesn't matter how much room your music takes up.

  • Some basic PlayForSure questions (Zen Xt

    The music on my Zen Xtra that I upgraded to the Playsforsure firmware is now organized into directories, apparantly based on album name in the ID tag. (I synched to a new directory before upgrading, and imported the directory afterwards)
    ) How do I create a new folder on the Zen Xtra? What software allows me to do this? I don't see the option in the Zen Xtra Media Explorer. And if it's possible, can I cause problems doing this?
    2) If I change the album in the tag of an mp3 file, does it move automatically to a directory of the new album name, perhaps creating a new directory? Or do I need to manually move the file myself, perhaps also creating a new directory manually (however that is done)?
    3) Can I make multi-level nested directories? For example, suppose I make a directory "Led Zeppelin Boxed Set" with four sub-direcories underneath it, one for each of the disks in the boxed set? Will this work OK? Is there a limit to how many levels deep I can go?
    4) Is there any way at all anymore to mark multiple songs and edit the tags of all marked songs at once, like changing the genre or artist? This was easy to do with Nomad Explorer.
    Thanks,
    Revtim

    I dont use Zen Media Explorer as its not supported by Dell DJ's, but nothing is stopping me from using Windows Explorer's interface. And with this you can make directories on the player, however the whole folder has to be copied over from the computer, you cannot simply right click and choose new folder. You can make as many sub directories as you like. In fact you can copy over your entire My Music folder or wherever you keep your music on your computer and it will create every single directoy and place every single song inside that directory. Exactly mirroring, file for file, what your computer has. The only thing it will not transfer is songs and files it cannot play. So it will only accept MP3, WMA, and WAV files, nothing else.
    But your Xtra does not care how many directories there are it will read through every single directory and sort the songs by its ID3 tag.
    The only downside to Windows Explorer is that you cannot edit any of the ID3 tags. But file names and directories can be renamed. Not like the player will care tho.
    But this is where I use Real Player, to edit all my ID3 tags of my songs... For some reason it doesn't allow me to edit the track number tag, which is very annoying....
    I'm not sure how much of what I said can be done in Zen Media Explorer, but at least it can give you a reason to remove it if its causing you any problems...

  • Some Basic N900 questions

    Hi Guys,
    I had one of my friends ask me this question he’s just bought his N900 very recently he wanted to know
    If for the first time is it necessary to charge the battery for the whole night, does that ensure a better battery performance.
     2. is it necessary to calibrate the screen on the N900 when you “ON” it for the first time and before you start using. What is the purpose of calibrate screen ?
    Cheers !

    the batteries take approx 1:45 to charge while off, and about about 2:15 if on and not really using it.
    (i use about 3-4 batteries/day, so i have a bit of experience  )
    so long as your little led goes green, doesnt matter.  this used to make a bigger difference with the ni-cd and ni-mh batteries, but not the batteries today.
    the calibration is not really necessary, but doesnt hurt anything to do so.

  • Some basic text questions

    1. when creating text with the Text tool, I see that it creates an anchor point at the beginning of the text, though I am unable to do anything with it
    with the Direct Selection Tool. Is there anything I can do with this anchor point, or is it just for lining things up?
    2. How do you decide which anti-aliasing option to use? Does it depend on the selected font? which works best for onscreen display? for print?
    Thanks.

    1) THe anchor point moves, for Point text, based on the text alignment. Aligned left, it's on the left. Aligned right, it's on the right. Aligned center it's centered. It is used for alignment and positioning to show where the base anchor is for the point text. Area text (text in a bo) on't have the single anchor point.
    2) All depends upon what you want. There is no standard setting.

Maybe you are looking for

  • Fact and dimension table relationship?

    hi in se38 i executed this program sap_infocube_designs i got all cubes and percentage , this is directly fact and dimension table relationship based on this i need to take action is it line item dimension or high cardinality (dimen>20% fact line, di

  • SAP XI and ESA

    Hi guys, Does anyone have any good material / suggestions on what to cover under the following topics for XI relating to an ESA: 1) BPM/BPEL modelling 2) integration with adapaters and routings 3) integration for business activity monitoring 4) creat

  • Tab page shortcut

    HI , I have problem creating shortcut for tabe page. In aplication there are six tab pages, and I need to have keyboard shortcut to every tab page.How to create that? At example, if user press ALT+R I want certain tab page to be toppage , or better w

  • Subcontracting multiple BoM levels for Project Stock

    Hi, We are an engineer / make-to-order manufacturer, so we use a lot of "individual" type materials (instead of collective).  We are trying to subcontract several BoM levels of work to different vendors, and we are seeing many false requirements. So

  • Db Time in Statspack report...

    Hi , I generated a statspack report of 22 minutes duration. In the Instance Activity Stats DB/Inst portion of the report , there are the following figures , regarding the Db Time statistic: Total Per Second Per Transaction 530,488 400.7 1,449.4 where