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 9156821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:51:45+00:00 2026-06-17T12:51:45+00:00

public static void main(String args[]) { double arr[] = {1,-6.3,9000,67.009,1.1,0.0,-456,6,23,-451.88}; ArrayList<Integer> List = new

  • 0
public static void main(String args[])
{
    double arr[] = {1,-6.3,9000,67.009,1.1,0.0,-456,6,23,-451.88};

    ArrayList<Integer> List = new ArrayList<Integer>();

     List.add(1);
     List.add((int) -6.3);
     List.add(9000);
     List.add((int) 67.009);
     List.add((int)1.1);
     List.add((int)0.0);
     List.add(-456);
     List.add(6);
     List.add(23);
     List.add((int)451.88);
}

public static int ArrayListMax(ArrayList List)
{

    for (int i=0; i<List.size(); ++i)
    {
        System.out.println(List.get(i));
    }

The error is in:

  public static int ArrayListMax(ArrayList List) 

This is probably a very nooby mistake, but I’m new to Java so forgive me.

Any help please?

Thank you.

EDIT:

I want the ArrayListMax method to print the size of the List!

  • 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-17T12:51:46+00:00Added an answer on June 17, 2026 at 12:51 pm

    Assuming you are trying to get the maximum value in your List in the method arrayListMax, you need to return an integer in accordance with your method signature, which the error is telling you

    This method must return a result of type int
    

    Instead of printing all the values in the list, you could do:

    public static int arrayListMax(List<Integer> List) {
       return Collections.max(list);
    }
    

    Use Java Naming Conventions. Method & variable names begin with a lowercase letter. Using this approach helps avoid confusion between instances & types (e.g. in the case of List in the main method).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class PizzaExamfinalOne{ public static void main(String[]args){ double total2 = 0; String customerName =
I was writing this code: public static void main(String[] args) { double g =
Given: public class LineUp { public static void main(String[] args) { double d =
public class Slice { public static void main (String [] args) { double d
In the following program class ZiggyTest2 { public static void main(String[] args){ double x
public class doublePrecision { public static void main(String[] args) { double total = 0;
public class TryMyMath { public static void main(String args[]) { double num = Math.E;
package homework1C; public class Homework1C { public static void main(String[] args){ double term =2,sum;
public class Demo { public static void main(String args[]) { double d = 12.345;
public static void main(String[] args) throws FileNotFoundException { double agentID; String type; double price;

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.