小编Jea*_*ett的帖子

为什么这个Java枚举代码没有编译?

enum itProfs {  
    private int sal;
    DEVELOPER(30), ANALYST(20); 
    itProfs(int sal){
        this.sal = sal;
    }
    public int getSal(){
        return sal;
    }   
}
Run Code Online (Sandbox Code Playgroud)

是什么原因?

java enums

0
推荐指数
1
解决办法
118
查看次数

合并Excel范围中的数据,删除空白和重复项

我在Excel中有一系列单元格,这些单元格的列宽度超过一列且长度超过一行.有些细胞是空白的.我想将非空白单元格合并(使用VBA)到列表中,删除重复项,并按字母顺序排序.

例如,给定此输入(其中短划线为此问题指定空单元格):

-  -  A  D  -
C  -  -  A  -
-  -  B  -  D
-  -  -  -  -
A  -  -  E  -
Run Code Online (Sandbox Code Playgroud)

生成以下排序输出:

A
B
C
D
E
Run Code Online (Sandbox Code Playgroud)

如示例输入所示,范围中的某些行和列可能包含所有空单元格.

sorting excel vba duplicates excel-vba

0
推荐指数
1
解决办法
3214
查看次数

在Excel中动态锁定单元格

我有四列(A,B,C,D).我的要求是在每一行中,只有一个单元格应该接受数据,其余单元格不应该接受数据(即其余三个单元格应该处于锁定模式).

我该怎么做呢?

excel vba excel-vba

0
推荐指数
1
解决办法
5632
查看次数

用于"堆叠"列的VBA解决方案

下面是我正在使用的表格的片段.

从左到右我需要知道如何将整个第二列附加到第一列.因此,从第二列的V5789开始,需要将其下面的所有内容放在第一列中的V854之后.第三列需要"堆叠"在第二列的底部.因此2附加到1,3附加到2,4附加到3.等.

有线索吗?

在此输入图像描述

excel vba

0
推荐指数
1
解决办法
2379
查看次数

根据水平和垂直速度计算方向和速度

我目前正在研究Java游戏,我想从所有游戏对象提供的水平和垂直速度计算方向和方向速度.我希望有一个类似下面的方法来计算物体朝向的方向/角度(基于它的水平和垂直速度);

public double getAngle() {
    // Calculate angle/direction from the horizontal and vertical speed here
    return angle;
}
Run Code Online (Sandbox Code Playgroud)

当然,我需要一种类似的方法来根据物体的水平和垂直速度计算物体的方向速度.

注意:当我问这个问题时,我没有学到任何关于几何/三角学的知识,因为我在第二或第三课.

java point angle direction

0
推荐指数
2
解决办法
4916
查看次数

二维int数组不接受我提供的维度

这是我GridGenerator班上的代码.目的是创建多个矩形房间,最终可以将它们连接在一起成为地图.

int xRange, yRange;

//constructor
public GridGenerator(int xInput, int yInput) {
    xRange = xInput;
    yRange = yInput;
}

int[][] grid = new int[yRange][xRange];
//the first number indicates the number of rows, the second number indicates the number of columns
//positions dictated with the origin at the upper-left corner and positive axes to bottom and left

void getPosition(int x, int y) {
    int position = grid[y][x]; //ArrayIndexOutOfBoundsException here
    System.out.println(position);
}
Run Code Online (Sandbox Code Playgroud)

这是我MapperMain班上的代码.目的是将GridGenerator实例连接到多房间地图.我现在也将它用于调试和脚手架目的.

public static void main(String[] …
Run Code Online (Sandbox Code Playgroud)

java arrays

0
推荐指数
1
解决办法
72
查看次数

月份函数抛出类型与VBA帮助文件中的示例代码不匹配

我检查了这里所有网站上,发现了几个解决方案,这一点,我试过,包括铸造NowCDate,但没有任何工程.

在Win7上使用带有Excel 2010的VBA编辑器.

即使是帮助部分中的示例代码也会抛出此错误,并且Month()函数中使用的日期将以数字形式显式初始化.

在这两种情况下,我尝试使用CDate()month()说法,这是行不通的.在我的原始代码中,我也尝试使用Date而不是Now,也没有效果.

这是我的原始代码,它在If条件上转换错误:

Function SetNextTaskNb()

    Dim seqNb As String
    seqNb = ThisWorkbook.Worksheets("Persistent").Range("A" & 1).Value

    Dim Nbs() As String
    Nbs = Split(seqNb, ".", 2)

    Dim month, currentNb, nextNb As Integer    
    month = CInt(Nbs(0))
    currentNb = CInt(Nbs(1))

    If month(Now) = month Then 
        nextNb = currentNb + 1
    Else
        nextNb = 1
    End If

    ThisWorkbook.Worksheets("Persistent").Range("A" & 1).Value = currentMonth + "." + nextNb
    ThisWorkbook.Worksheets("Sheet1").Range("A" & 1).Value …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba type-mismatch

0
推荐指数
1
解决办法
909
查看次数

在最后(或第四次)出现"."时分割字符串.分隔符

我喜欢将字符串分隔如下

给定以下字符串:

Column 1    
10.80.111.199.1345
127.0.0.1.3279
Run Code Online (Sandbox Code Playgroud)

我想在最后一个"."之后划分数字,这将得到以下输出

 Column 1       Column 2               

10.1.12.5       1345
127.0.0.1       3279
Run Code Online (Sandbox Code Playgroud)

我知道excel有分隔符功能,允许我用特定符号或固定宽度分隔.它似乎不适用于固定宽度.

有没有其他选择,而不是用"."分隔.可以在第1列上找回字符串吗?

excel excel-2007 excel-formula delimiter

0
推荐指数
1
解决办法
1万
查看次数

获取单元格中最大的逗号分隔值

在一个单元格中,我有逗号分隔的数字.我想拥有这些数字的最大值.

例如:A1 ="2,5,1,4"

什么应该是B1中的公式返回值5?

excel excel-formula

0
推荐指数
1
解决办法
4317
查看次数

方法不起作用?

更新的代码:

import java.util.*;

public class Main {

/**
 * @param args
 */
static int[] C;
static int[] D;
static String P;

public static void main(String[] args) {
    C = new int[10];
    D = new int[10];
    getNumber();
}

private static void getNumber() {
    System.out
            .println("Enter your first number with spaces in between digits.");
    Scanner S = new Scanner(System.in);
    String O = S.nextLine();
    String[] A = new String[10];
    A = O.split(" ");
    for (int X = 0; A.length > X; X++) { …
Run Code Online (Sandbox Code Playgroud)

java

-1
推荐指数
1
解决办法
84
查看次数

Random.nextInt(1); 只返回1

这是我的Minecraft mod算法.由于某种原因,似乎rand.nextInt(1);只返回1.为什么?

public void generate(){
    Random rand = new Random();
    Arrays.fill(wc,null);
    int c = generateCat();//Generates a int of 1-16 randomly
    int i = 0;
    int xi = 0;
    int x = getCoordX();
    int y = getCoordY();
    int maxc = 0;
    boolean d1 = true;
    boolean d2 = false;
    boolean d3 = false;
    boolean d4 = false;
    boolean loop = true;

    wc[0] = new WeatherChunk(world,x,y,c);//Here the starting object is generated
    x=x-1;
    if(rand.nextInt(1)==1){//Here the c value (is supposed to have …
Run Code Online (Sandbox Code Playgroud)

java random minecraft

-1
推荐指数
1
解决办法
1705
查看次数

从单元格中的字符串中删除前导零

如何0使用相同的公式从以下文本中删除第一个s?

0700.hk --> 700.hk

0027.hk --> 27.hk

0001.hk --> 1.hk

有些不会有零

1929.hk --> 1929.hk

excel excel-formula google-sheets

-2
推荐指数
1
解决办法
1390
查看次数

用C检测大小写

#include <stdio.h>
#include <stdlib.h>

int main() {
    char c;
    printf("Hello World ! Right something you want to know about\n");`

    scanf_s("%c", &c);

    if (c = 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O','P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z') 
    {
        printf("\nThe input is an upper case letter\n");
    }
    else if  (c = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'q', 'r', 's', …
Run Code Online (Sandbox Code Playgroud)

c

-10
推荐指数
1
解决办法
578
查看次数