Java (maths) error? How to solve?

Hi, here is some of my code,
public static void main(String [] args)
int num1;
int num2;
int num3;
num1 = 3;
num2 = 3;
num3 = 3;
if ((num1 == num2) && (num1 == num3))
System.out.println("Your triangle is equalateral, all sides are the same length!");
if (((num1 == num2) && (num1 != num3)) || ((num1 == num3) && (num1 != num2)) || ((num2 == num3) && (num2 != num1)));
System.out.println("Your triangle is isosceles, two sides are the same length!");
if ((num1 != num2) && (num1 != num3) && (num2 != num3));
System.out.println ("Your triangle is scalene, no sides are the same length!");
if ((((num1 num2)<num3) || ((num2 num3)<num1) || ((num1 num3)<num2)));
System.out.println ("Your 'triangle' isn't a triangle!");
I keep getting error with just this 1 line?
if ((((num1 num2)<num3) || ((num2 num3)<num1) || ((num1 num3)<num2)));
I do not know why, JavaBeans says "illegal start of expression"
Please can someone help? Thank you.

FYI another way to write this could be:
int equalsSides = (num1 == num2 ? 1 : 0) +
        (num1 == num3 ? 1 : 0) +
        (num2 == num3 ? 1 : 0);
switch (equalsSides) {
    case 3:
        System.out.println("Your triangle is equilateral, all sides are the same length!");
        break;
    case 2:
        System.out.println("Your triangle is isosceles, two sides are the same length!");
        break;
    default:
        System.out.println("Your triangle is scalene, no sides are the same length!");
}

Similar Messages

  • Java.lang.error How to..

    I have serious problem..a lot of java games/applications show this error: java.lang.error (not found..) how can i make its work? my phone have midp 2.0..there isn't a soluction? pleeese help me

    Hi Patrick
    The interface is not changed and also the note no. as suggested by the Nagarajan is also not helpful. I would like to know what kind of illegal access i'm trying to do as nothing it is specifying in the Stack trace.
    Following is the stack trace:
    <i>
    java.lang.IllegalAccessError: tried to access method com.bp.ngl.cust.bwmodel.BWModel.wdGetStaticMetadataCache()Lcom/sap/tc/webdynpro/modelimpl/dynamicrfc/DynamicRFCModel$MetadataCache; from class com.bp.ngl.cust.bwmodel.Zy_Search_Supp_Reports_Bw_Input
        at com.bp.ngl.cust.bwmodel.Zy_Search_Supp_Reports_Bw_Input.<init>(Zy_Search_Supp_Reports_Bw_Input.java:51)
        at com.bp.ngl.custsupp.FindReportComp.<init>(FindReportComp.java:433)
        at com.bp.ngl.custsupp.wdp.InternalFindReportComp.<init>(InternalFindReportComp.java:447)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    </i>
    Thanks
    Srikant

  • Ms ODBC driver error -- How to solve

    when I run a java code that has JDBC-ODBC link sometimes is sucessful but sometimes failed. Please give some advise!!!! Thanks
    error msg :
    SQLException: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed
    source code :
    import java.sql.*;
    import java.util.*;
         public class CreateCustomer {
         public static void main(String args[]) {
              String url = "jdbc:odbc:rd";
         Connection con;
         String createString;
         createString = "create table CUSTOMER " +
         "(CUST_CODE VARCHAR(10), " +
                   "CUST_NAME VARCHAR(40), " +
                   "CUST_ADD VARCHAR(40))";
              Statement stmt;
         try {
              Class driverClass = Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    DriverManager.registerDriver((Driver)driverClass.newInstance());
              catch (Exception t) {
                        t.printStackTrace(System.out);
         try {
         con = DriverManager.getConnection(url, info);
    stmt = con.createStatement();
    stmt.executeUpdate(createString);
    stmt.close();
    con.close();
              catch(SQLException ex)
         {  System.err.println("SQLException: " + ex.getMessage());
    }

    DriverManager.registerDriver((Driver)driverClass.newInstance());Have you tried it without this line?
    Kind regards,
      Levi

  • My safari dont open and give a libroos error how to solve thanks

    My safari dont open and give a error message  "libroosksbas.dylib plug-in."
    what to do to solve
    thanks

    That is Rapport  bank security software.
    Uninstall Trusteer software
    http://www.trusteer.com/support/uninstalling-rapport-mac-os-x

  • A compiler error, how to solve?

    Such a hint, find definition, fl. Controls. The Label, how to solve

    You should include the complete error message in your posting.  If you are having a problem trying to dynamically add a Label component, be sure that you have a Label component placed in your library.

  • Jdk1.6.0 run error, how to solve?

    I am using Linux-fedora6.0 , downloaded jdk1.6.0 . I am working in an standalone machine.
    javac can compile properly my file, but java can't run my class file that is created by javac.
    Error msg. " Exception in thread"main" java.lang.classFormatError... unrecognized class file version.
    at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
    Please anyone give solution.
    Dulal Acharjee
    [email protected]
    [email protected]
    21.01.07

    I suspect you are picking up an old version of java. Try using the full path to your java 1.6.
    /the_path_to_your_jdk_1_6/bin/java YourClass
    If this works then you need to setup your PATH (NOT CLASSPATH)so that the directory
    /the_path_to_your_jdk_1_6/bin
    is searched before the system paths then it will pick you your 1.6 Java instead of the old version.
    Message was edited by:
    sabre150

  • A run-time-error ,how to solve it

    I write a function to return a float64 type pointer and  assign the pointer to my defined Pionter "newdata" in  my StartCallBack,there's no error,but when I USE  "
    DAQmxWriteAnalogF64 (gtaskhandle0, leng[0]<=leng[1]?2*leng[0]:2*leng[1], 0, 10.0, DAQmx_Val_GroupByScanNumber, newdata, &written, NULL);",
    I get a run-time-error like this : "work.c", line 231, col 121, thread id 0x00007FB4:   Array argument too small (40000000 bytes).  Argument must contain at least 80000000 bytes (10000000 elements).Why this happen?
    My part code:
       DAQmxCreateTask ("", &gtaskhandle0);
       DAQmxCreateAOVoltageChan (gtaskhandle0, "Dev1/ao0:1", "", -10.0, 10.0, DAQmx_Val_Volts, "");
       DAQmxSetTimingAttribute(gtaskhandle0,DAQmx_SampClk_Rate,1000/looptime);
       DAQmxCfgSampClkTiming(gtaskhandle0,"",1000/looptime,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,leng[0]+leng[1]);
       DAQmxRegisterDoneEvent(gtaskhandle0,0,DoneCallback,NULL);
       DAQmxWriteAnalogF64 (gtaskhandle0, leng[0]<=leng[1]?2*leng[0]:2*leng[1], 0, 10.0, DAQmx_Val_GroupByChannel, newdata, &written, NULL);
       SetCtrlAttribute (panelHandle, PANEL_REALWRITE, ATTR_CTRL_VAL, (double)written);
       DAQmxStartTask(gtaskhandle0);
    Solved!
    Go to Solution.

    I do not think so ,when  I modificate the channel from "Dev1/ao0:1" to "Dev1/ao0",it works normally ,but I can output only in one AO channel by this way ,rather than in two AO channels.
    float64 * volarray(double ti[],double vi[],int num,int len,double looptime)
      int k=0,sum=0,m=0;
      float64 *p=NULL;
      p=(float64 *) malloc(sizeof(double)*len);
      for(k=0;k<num-1
       if(ti[k]<ti[k+1])
        {for(m=0;m<(int) (ti[k+1]-ti[k])/looptime;m++)
         p[m+sum]= vi[k]+m*(vi[k+1]-vi[k])/((ti[k+1]-ti[k])/looptime);
           sum+= (int) (ti[k+1]-ti[k])/looptime ;
        k+=1;
       else
        {for(m=0;m<(int) (ti[k+2]-ti[k+1])/looptime;m++) 
         p[m+sum]= vi[k+1]+m*(vi[k+2]-vi[k+1])/((ti[k+2]-ti[k+1])/looptime);
        sum+= (int) (ti[k+2]-ti[k+1])/looptime ;
        k+=2;
       return p;}
    float64 * JointVol( float64 *data0, float64 *data1, int len0, int len1 )
    {  int i=0;
       int totalLen=0;
       float64 * P=NULL;
       if(len0<=len1)
        totalLen=2*len0;
       else
           totalLen=2*len1;
       //totalLen=((len0<=len1)?len0:len1)*2;
       P=(float64*)malloc(sizeof(double)*totalLen);
       for(i=0;i<(totalLen/2);++i) 
       P[2*i]=*(data0+i);
       P[2*i+1]=*(data1+i);
    return P; 

  • Serialization Error.How to solve?

    Hi All,
    I have actived the serialization in my inbound system.Now i am getting an Error
    ' Serialization error for object 01,P,00058634 . Expected counter 000001 <
    000002 in IDoc'. It is saying  The expected serialization counter has the value 000001. However, the serialization counter in the IDoc has the value 000002 and is therefore too big'
    I am not understanding how should i find which is the counter 000001 IDOC.
    How to find the cause of the error?Please guide.
    Regards,
    Prajakta

    Hi narayanan,
    I got the solution.I will tell you if it helps you.
    I checked the IDOC with same oject &with SERIAL_COUNTER = 1.
    so i found the previous unposted IDOC having same atributes.
    Thanks,
    Prajakta

  • Mail SMTP configuration error: how to solve?

    I have two problems with configuring SMTP accounts on my iPhone (4s, with IOS7):
    1) the SMTP is configured, but iOS puts the wrong username together, so login fails. Here is, how:
    SMTP server: smtp.myprovider.com (this is the SMTP of my provider)
    username: [email protected] (mydomain.com is the domain I host there, and the EMAIL is my username!)
    All other settings are trivial and correct.
    ... And now my iPhone connects (correctly) to the SMTP smtp.somewhere.com, but logs in with the username "[email protected]@smtp.myprovider.com" which obviously must fail.
    Any suggestions?
    2) I have several accounts (POP and IMAP), all of which need THEIR SPECIFIC SMTP account. Why?
    Because an increasing number of providers have their SPAM filters configured so as they throw away (they don't even reject sometimes) all mail which is not sent by the SMTP of the provider where the domain is hosted (quite sensibly, though).
    iOS lets me configure a primary SMTP and other SMTP, but does not let me configure ONE SMTP per ACCOUNT each. Or did I miss something?
    The result: All mail is sent via the primary SMTP (which accepts mails from any email to any email as long as I am authentified), and some mails get thrown away by SPAM filters because the SMTP does not match the mail address.
    Any suggestions would be deeply appreciated!
    These things just threw my iPhone useless for mail for any mail account with is (what a shame!) not a MS Exchange account ... Steve would rotate in his grave if he heared that.

    watch on sun forum.

  • Netscape 7.1 has java plugin problems, how to solve, part 2?

    I have a Linux computer and in /usr/local/netscape/plugins,
    I did
    ln -s /home/xxx/j2sdk1.4.2_04/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so .
    The netscape can starts, but my java applets were not able to be loaded,
    and under Help->About Plug-ins, there is nothing indicating a java plug-ins.
    So Please help. Thank you.

    try reading this:
    http://forum.java.sun.com/thread.jsp?forum=54&thread=358458

  • Javax.servlet.servletException and root cause error(how to solve?)

    Hi! ALL,
    I have created a enterprise application using netbeans IDE , j2ee and jboss server.Now I want to run that enterprise application in remote server as jboss.I have uploaded that application in remote server.I am running in this way
    http://IP Address/CustomerBook2-war/CustomerDetail.

    Read the exception message of the root cause. If you don't understand the message, copypaste that message in Google and check the results.

  • How to solve the error while  Deploy a BC4J JSP Application using tomcat,

    hello,
    how to avoid the following error?
    i am using jdevloper for devloping jsp applications.
    after that i am calling the jsp page using tomcat4.0 ,i followed the steps according docs by jdev team,
    i am getting the following error how to solve this,
    can one help?
    =============================
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    org.apache.jasper.compiler.CompileException: /AccountView_Browse.jsp(4,0) Unable to load class oracle.jbo.html.jsp.datatags.ApplicationModuleTag
    at org.apache.jasper.compiler.TagBeginGenerator.init(TagBeginGenerator.java:139)
    at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.init(JspParseEventListener.java:829)
    at org.apache.jasper.compiler.JspParseEventListener.addGenerator(JspParseEventListener.java:153)
    at org.apache.jasper.compiler.JspParseEventListener.handleTagBegin(JspParseEventListener.java:1039)
    at org.apache.jasper.compiler.DelegatingListener.handleTagBegin(DelegatingListener.java:221)
    at org.apache.jasper.compiler.DelegatingListener.handleTagBegin(DelegatingListener.java:216)
    at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:852)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:1145)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:1103)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:1099)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:214)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:210)
    at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
    at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
    at java.lang.Thread.run(Thread.java:536)
    ====================
    thanks
    pullareddy

    I had very similar problems with adding the correct JDeveloper .jar files to Tomcat's lib folder, but did eventually resolve my issues.
    The problem I am having now, however, is the following error message:
    Error Message: oracle.jbo.html.RequestParameters.addParameter(Ljava/lang/String;Ljava/lang/String;)V
    Yes, I have deployed the bc4jhtml.jar file from JDeveloper to Tomcat\common\lib!
    My web-app is a very simple BC4J JSP application. I have one BC4J component in its own project and JAR file, and one JSP referencing that BC4J component - I deploy the BC4J JAR along with the WAR file from the JSP project. Needless to say, the JSP works fine within JDeveloper..!
    I'm using JDev 9.0.3 and Tomcat 4.1.12. Does anyone have any suggestions?
    Thanks,
    S.

  • How to solve ORA-01843: not a valid month error

    i am gettion ORA-01843: not a valid month error how to solve it. and how to find which record causing
    proble.
    Thanks in advance.

    EdStevens wrote:
    Ramin Hashimzadeh wrote:
    user1571313 wrote:
    i am gettion ORA-01843: not a valid month error how to solve it. and how to find which record causing
    proble.
    Thanks in advance.Bring for me something from somewhere... :)Bring me a shrubbery.
    When you have found the shrubbery, then you must cut down the mightiest tree in the forest ... with a herring.We are no longer the knights who say ni! We are now the knights who say "i am gettion ORA-01843"!

  • When make GRN i receive this message how to solve this?

    When making GRN I receive this error how to solve this?
    The UOM conversion does not exist
    Procedure
    The UOM conversion does not exist in the material master for the material and UOM entered
    Not maintained alternative unit of measure
    I  have checked in material master, inforecord, and purchase order. All are correct
    Execues for unrelated answer

    If ur purchasing uom is different from base unit of material master data,
    maintain alternative unit of measurement,Click additional data maintain alternative uom in it to avoid this error.

  • How to Solve NullPointerException in WebService handling

    hi experts,
    >>  I am in initial stage in Web Dynpro
    >>  I created one webservice ( just Add to number)
    >> My Nodes Structure is
                AddNode
                 !____AddInput_Node
                         !---Num1
                         !---Num2
                 !____AddOutput_node
                        !---result
    I set Cordinality 1-1 to all nodes
    When I  run my application , i got NullPointerException error
    how to solve this error
    Pl can one help me...
    Advance Thanks
    Balaji

    Hi ,
    The problem is not with the model , in the context you have to intantiate the node to which the context is binded .
    Kindly look at the following learning material
    https://www.sdn.sap.com/irj/sdn/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#63
    regards
    Dhawal

Maybe you are looking for

  • Standard S_TCODE object showing Yellow trafic light

    Hi All, Recently I have noticed standard s_tcode object is showing Yellow traffic light (Not fully maintained) in one of the role in ECC6 system. I have tried to maintain by clicking on change button which usually doing with other objects and got suc

  • Code that handles a set of questions from database and place it on JSP

    Hi, How to write a code that handles a set of Quiz questions from database and place it on JSP page.. Thanks in advance Haritha

  • IPod reboots in an infinite loop!!! :-(

    hi all, I've had many iPods, starting from the 5 GB mechanical wheel model -- but what happened right now was the worst thing ever and I'm really p*ssed. All of a sudden, my 60GB color iPod began to boot while standing in its dock. But it didn't boot

  • The Connection has timed out

    I have problem acchisessing this site named http://gifthulk.com The connection has timed out What should i do? I tried in different browsers,cleared by cache,cookies and also re-installed firefox. But it does not works,what should i do?

  • How to get out of disk mode

    After I reset my iPod in disk mode, I can't seem to get out of it. I try pressing the right buttons, but after the Apple logo shows up, the folder with the ! comes back. What should I do?