Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:30:28+00:00 2026-06-11T11:30:28+00:00

How do I give input directly, when that function is invoked in another method,

  • 0

How do I give input directly, when that function is invoked in another method, especially when that input is a double[] array?

public double dotPro1(double[] vectorA, double[] vectorB) {
    double[] vecPro;
    vecPro = new double[2];
    vecPro[0] = vectorA[0]*vectorB[0];
    vecPro[1] = vectorA[1]*vectorB[1];
    return vecPro[0] + vecPro[1];
}
public double dotPro2(double[] length) {
    double[] lenPro;
    lenPro = new double[1];
    lenPro[0] = length[0];
    return lenPro[0];
}
public static double cosine(double a) {
    double x = Math.cos(Math.toRadians(a));
    /*Class c = Class.forName("NaiveStrategy");
        Class methodTypes[] = new Class[3];
        methodTypes[0] = Double.TYPE;
        methodTypes[1] = Double.TYPE;
        methodTypes[2] = Double.TYPE;
        Method[] m = c.getMethods();*/
    NaiveStrategy ns = new NaiveStrategy();
  problem-->ns.dotPro1(vectorA[], vectorB[]);
  problem-->ns.dotPro2(length[]);
    return 0;  
}

As you can also see my old coding I tried in another way to solve it, but it didn’t worked. It’s commented out above.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:30:29+00:00Added an answer on June 11, 2026 at 11:30 am

    You said in one comment that you want random values. So use the Random class to generate them.

    double[] list1 = new double[5];
    double[] list2 = new double[5];
    Random rand = new Random();
    for (int i = 0; i < list1.length; i++) {
        list1[i] = rand.nextDouble();
    }
    
    for (int i = 0; i < list2.length; i++) {
        list2[i] = rand.nextDouble();
    }
    

    The new double[5]; will create an array of length 5. Change this number to the length you want.

    Note: rand.nextdouble only gives a random number between 0 and 1. If you wish it to , say, be between 0 and 100 then use rand.nextDouble()*100

    You can then just use

    double result1 = ns.dotPro1(list1, list2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I give possibility to user to input strings with unique keys that represent one-line
If i give input as 1 or 2, regardless of that program goes in
my problem with vsprintf is that I can not obtain input arguments directly, I
I want to give integer input to Ruby like this: 12 343 12312 12312
How can I give the input field below the characteristics listed below? Characteristics: -Text
What is a good way to give the input field below the three characteristics
pt=[2] pt[0]=raw_input() when i do this , and give an input suppose 1011 ,
hay all, I just did the following: a = input(give a word: ) b
I am trying to give a text input a drop-shadow & a inner shadow,
I am new to Software Development, could you please give me some input into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.