Trivia

Explain:
class test
     public static void main(String args[])
          String file = "-134343";
          System.out.println(file.substring(0,2));
          if(file.substring(0,2) == "-1")
          System.out.println("yes");
          String file1 = "-1";
          System.out.println(file1.substring(0,2));
          if(file1.substring(0,2) == "-1")
          System.out.println("yes");
o/p is:
-1
-1
yes
why not yes in both cases??

Why not review the source code for method substring? Realize that other implementations of substring can yield different results.
public String substring(int beginIndex, int endIndex) {
     if (beginIndex < 0) {
         throw new StringIndexOutOfBoundsException(beginIndex);
     if (endIndex > count) {
         throw new StringIndexOutOfBoundsException(endIndex);
     if (beginIndex > endIndex) {
         throw new StringIndexOutOfBoundsException(endIndex - beginIndex);
     return ((beginIndex == 0) && (endIndex == count)) ? this :
         new String(offset + beginIndex, endIndex - beginIndex, value);
    }Note "this".
Message was edited by:
DrLaszloJamf

Similar Messages

  • Problem re: availability of Trivia Crack (ad free) in US store

    Hello:
    The other day, I purchased and downloaded the ad free version of Trivia Crack.
    I have not been able to get it to sync to my iphone 4.  I went into the app store and it told me that this app was not available in the US store.
    If this is true, how was I able to download (and be charged for) this application?
    Any ideas?

    On your last sync, it appears you were not logged into the iTunes store on your computer....when you sync it gets your account info from your computer if you are logged into the iTunes store, thus knows where you are and what you can get.
    Try logging into the iTunes store on your computer then resyncing.

  • Trivia Game: Error while testing CS3 app in CS4

    I have been attempting to test an exercise file for a Trivia
    Game written in AS3 using the Flash CS3 IDE.
    Unfotunately I have been receiving two errors each time its
    run while using Flash Professional CS4.:
    <ol>
    <li><strong> 1023: Incompatible override.
    </strong></li>
    <li><strong> 1021: Duplicate function
    definition.</strong></li>
    </ol>
    each of these errors occur on the same line:
    <ul>
    <li> <strong>public function showScore()
    {</strong></li>
    </ul>
    Can anyone help? The code and every

    It appears that showScore is some sort of reserved word in
    CS4 or one of the CS4 libraries. Just change every showScore in the
    code to something else like showGameScore and it should
    work.

  • Trivia game that does NOT require data

    looking for a trivia game that does not require an Internet connection. We are going camping and like to play a trivia game around the camp fire, but there is no cell service or data or wifi. We have used Mr Trivia for the last couple years but have ran out of new questions. Looking for something simular in function. Most of what I've tryed does not funtion without running data.
    ipad, iphone or pod (mutiple generations)
    thanks

    dalewren wrote:
    Are there any carriers that allow this?
    Not that I'm aware of. In fact, many carriers, if they detect an iPhone on their network without a data plan, will either bill you for such or cancel your service.

  • Scoring in a trivia game

    I'm putting together a flash trivia game. I want the score to
    be revealed only after all the questions have been answered.
    Something like this:
    1-5 right, try again
    10+ right, good job
    15+ you're getting better
    20+ you're a master
    So, I need some script to remember the score, and keep it
    hidden, and count the right answers and reveal them at the end.
    Can someone help me with this?
    I'm kinda new to action scripting

    To be able to play existing sounds fragments and play generated tones you can use the Mobile Media API (MMAPI). Check whether your target JVM implementation supports MMAPI.
    To be able to play a certain tone you could use something like this:
    (check the API specification of the 'javax.microedition.media' package)
    Manager.playTone(int note, int duration, int volume)
    That should do the trick.
    Jasper

  • Making a trivia game.

    I was looking at making a sports trivia java game. I want to make it so it starts with 20 seconds and goes down and the faster you answer it the seconds left equals how many points you get. Does anyone have any left over code or a similar style of game? I won't be putting it online or anything I am just making it for a friend and thats it so no real code stealing and making profit or anything. So can you please help me?
    Thanks

    SomethingCool wrote:
    I have all the questions and everything done. I just need help getting started on the actual game.
    Thanks"Help getting started" is very different from "a tutorial that has exactly what to do". So which do you want? The code so you can re-type it yourself? Or the basic concepts and techniques so you can actually create code yourself?

  • Simple Trivia game

    I am attempting to design a very simple trivia game. It needs to include if and for statements. Can anyone link me to a place they know of that shows me how?

    pastramigod wrote:
    More of how to incorporate it into a trivia game.There's no specific instructions for this that I know of. You're just going to have to play and experiment with your code. In fact, I recommend that you play and experiment with your code, because even if you don't get a decent game running, you are sure to learn a lot. Please come back with your code samples if you run into problems.

  • Music trivia game error message

    i'm having problems accessing my music trivia game. it worked when i got the ipod last week, but now that i've used it a bit, whenever i go to play my music trivia, "no songs found, error" appears on my screen. does anyone know why? is there some way i can fix it? i have only deleted a couple of songs and added a whole album (18 songs) but that's the extent of the changes i've made with the nano. any help would be appreciated
    thanks
    PC   Windows XP   Sony

    If I reset the iPod, that means all the songs will be deleted too, right? I'm still a little unclear with all these 5 R's thrown into the mix every which way!
    Thanks

  • Basic Trivia Game

    I am looking to make a trivia game as a special feature on my dvd for my kids...1 trivia game per each kid 10 questions each...After each question a track is going to with them saying YAY or NO and then it proceeds to the next question....The questions do not need to be in random order....infact id prefer they are not...also id like at the end of the quiz for a menu to say how many they got right out of how many....i have developed a way to do this however it involves using over a hundred menu's and tracks with different end jumps...i do not know anyhting about scripting but i am willing to use it if someone lays it out for me....im using DVDSP4.....and ideas?

    Do a quick search using the "more options" and search last year, just put the word "trivia" in the DVD SP forum and there are many threads. I think some of them had some details and point to projects files

  • Trivia for Siri

    Hi there,
    Siri is a very useful assistant, when you drive a lot in a car. Would be very nice if she could entertain the user a little bit more, like playing answering games (trivia etc).. Are there any extensions?

    No.

  • Need a little help with a trivia game

    Hey guys I was wondering if I could get some help. I'm taking a class at school for java programming and its my first class. And I have to do a final assignment, which is to make a java trivia game. I have all the parts coded already pretty sure. Now be forewarned that I'm not "that" great at programming.
    But the part that I'm stuck on and cant really get any help on is this: For the game I need to have a file with all the questions and answers, which is created already and works. The file writer has the question, choice 1, choice 2, choice 3, choice 4 and the answer written to it, in that order. We needed to implement a GUI and I coded that as a message label on top where the question will go, in the middle 4 radio buttons where the choices to the answer will go and on the bottom a next question, ok and quit button.
    My question is this: How do I pull the information from the file that was written to appear in the GUI, such as the question and the choices for the answers for the question? ANY and ALL help would be appreciated

    Read the information using a BufferedReader wrapped around a FileReader. Change your GUI using setText on the component you want to display the text.
    Edit: An example that does both things
    import java.io.*;
    import javax.swing.*;
    public class FileAndSwing {
       public static void main(String[] args) throws Exception {
          BufferedReader reader = new BufferedReader(
                new FileReader("FileAndSwing.java"));
          StringBuilder builder = new StringBuilder();
          for ( String line = null; (line = reader.readLine()) != null; ) {
             builder.append(line).append("\n");
          JFrame frame = new JFrame("FileAndSwing.java");
          frame.setSize(500, 500);
          JTextArea field = new JTextArea();
          frame.add(field);
          field.setText(builder.toString());
          frame.setVisible(true);
    }This is also kind of a Quine :-).
    Edited by: endasil on 15-Dec-2009 4:00 PM

  • Playlist script and random trivia

    This is a bit confusing so i'll explain as best as i can.
    I'm using Alex Alexander playlist script from thanks to Hal's awesome website, i have 12 different choices to choose from on that menu and that part works perfectly, i can choose 1 topic or all 12 and they will play those clips, ok what i'm trying to do now is change it from playing clips to a random trivia questions, each topic on the main playlist menu, example: knowledge about animals choose it and there will be 100 trivia questions about it or choose 2 topics and both topics will start 1 trivia game together and randomly pick from that pool of 200 questions, i've done a few smaller trivia questions in the past best 8 out of 10, so i know it works but this is on a higher scale and just wanted some input into how to accomplish it.
    Thanks, Charles

    ~ Trevor ~ wrote:
    Hi Eliezer,
    Here's the script for point 3,
    var  doc = app.activeDocument, ol, pl, tfl,
            myObjects = doc.splineItems.everyItem().getElements();
    var   myParas = doc.stories.everyItem().paragraphs.everyItem().getElements();
    var   myTexFrames = doc.textFrames.everyItem().getElements(); // I don't know if you want this
    ol = myObjects.length;
    pl = myParas.length;
    tfl = myTexFrames.length;
    while (ol--) myObjects[ol].appliedObjectStyle = doc.objectStyles.anyItem ();
    while (pl--) myParas[pl].appliedParagraphStyle = doc.paragraphStyles.anyItem ();
    while (tfl--) myTexFrames[tfl].appliedObjectStyle = doc.objectStyles.anyItem ();
    If you want the script for point 1) I'll do it for $10 (paypal) if some else want's to do it for 10 points if not then be in touch if it's worth your while.
    Regards Trevor
    Are you still available to write that script? How can I get in touch with you for my exact specifications?

  • Trivia Crack App

    I was really enjoying playing this game but for the last couple of weeks it shows my lives as FULL but I have 0 lives and it won't allow me to play. I have purchased the app with no ads and bought a life refill and still gives me the same message.
    I have sent several messages to the game developers and have received no response.
    Did anyone experience something similar with a game?  What can I do?  How can I get my money back if the game doesn't work?

    Greetings simplywen3,
    Welcome to the Apple Support Communities!
    I understand that you have an application, Trivia Crack, that is not behaving as you would expect. I also understand that you have sent the app developer messages and have not received a response. In this situation, you may want to report the problem directly to Apple using the information in the attached link. 
    Report a problem with an item purchased from the iTunes Store, App Store, Mac App Store, or iBooks Store - Apple Support
    Cheers,
    Joe

  • Cannot Sync Trivia Pursuit APP.

    I Have an "Ipod Nano, (1st Gen)," and "Itouch 16GB." After purchasing and downloadinf Trivia Pursuit from Itunes I cannot sync the application to either device. I originally wanted the app strickly for the Itouch but found to my dismay it apparently won't run on that device. However, indications are that it is suppose to load and run on my Nano. The app has an "IPG" extension.

    If you are referring to the game Trivial Pursuit (which is not an app), then it only runs on the 3rd/4th gen nanos, the 5th gen iPod and the iPod classic. It states this at the top of the games page, and I guess you are referring to a game since it has the extension "ipg" (iPod game).
    It won't run on any other iPod or on a computer.
    Apps only run on the iPod Touch and I cannot see a Trivial Pursuit app in the iTunes store (at least, not in the UK store).

  • Scripting Random Trivia in DVD Studio Pro

    I've used the search functions and haven't seen an answer so I though I'd post.
    Does anyone know how to script slides for trivia in DVD Studio Pro. Especially the ability to have random slides. I thought I read that if you have questions your slides with teh question and then answer have to be listed as a and b respectively so they can be tied ot each other.
    Any help would be appreciated.
    Thanks,
    Richard

    Welcome to the boards
    Some trivia threads
    http://discussions.apple.com/search.jspa?threadID=&q=trivia&objID=f952&dateRange =all&userID=&numResults=15&rankBy=10001
    Quizes
    http://discussions.apple.com/search.jspa?threadID=&q=quiz&objID=f952&dateRange=a ll&userID=&numResults=15&rankBy=10001
    And random bingo
    http://dvdstepbystep.com/bingo.php

  • Trivia game app with real money

    hi,
    i`m working on a trivia game app that involves a tournament with money prizes.
    i haven`t been able to understand what`s allowed to do under the apple guidlines concerning possible means of payment for credits to the tournament.
    1 - can i use In App Purchase to allow the players to buy credits for the tournament where they can win money?
    2 - can i have a native page allowing them to buy credits to the tournament using credit card or paypal? if not can i open a browser asking them for their credit card\paypal?
    Thanks!
    Ido

    Because the game is only 99 cents? It shouldn't matter, itunes is getting money either way, I already paid for the card and redeemed it to my account. How ridiculous.

Maybe you are looking for

  • Problem while sending output to a printer

    Hi, I am trying to send an output to a remote printer (on the same LAN) I have the remote printer configured on my machine, and while adding a new printer in Central's printer database, I am specifying the IP address of the printer in the physical de

  • PDFs show up as having "0" data on the recipients email

    When I attach a PDF file to an email I am sending some recipients get a "0" data PDF. On some of them the PDF Logo has a gray bar near the bottom with a small white circle on the left. Not all recipients have this problem and I can sent from web base

  • Can't choose bootable partition at startup

    Apart from what I'm about to say, my system is working just fine. It boots up quickly, loads the desktop, and runs all apps snappily. It receives regular maintenance with both TechTool Pro 4 and Diskwarrior with no issues. When I attempt to boot up f

  • Webservice: Flex to CFC

    Hi I'm triing to send a complex Object (AS) from Flex to a simple test Webservice CFC. If I create an Object in ActionScript an send this to my Webservice, the Object will not be received from the CFC ( return String is "NO"). How can I send a comple

  • Users not given option to "Use my Microsoft Windows user ID"

    Hi guys. Anyone seen this before? When our users connect to BPC, either through IE or straight from Excel, they get the following: The first time they connect in any session (after a reboot, logon, etc.) they are offered both options to sign in... "U